guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anyone having guile binding for libiconv or librecode?


From: Kevin Ryde
Subject: Re: Anyone having guile binding for libiconv or librecode?
Date: Sat, 16 Dec 2006 07:11:48 +1100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Stan Pinte <address@hidden> writes:
>
> I am trying to make string encoding correction in guile...would anyone
> have developed a binding for libiconv or librecode? Or any other
> clever suggestion?

My code below using iconv going to and from utf8.  "chart_iconv()" is
the guts.  It's obscured a bit by coping when iconv isn't available.
There's slackness in sizing the output buffer, I assume a char is no
more than 4 or 6 bytes :).  The utf8->locale routine tries to
transliterate when there's no locale char for a given utf8, it's
designed for human output.

I didn't try to wrap an actual iconv_t, the only bits I was needing
was to and from the locale charset, so an iconv_t for each direction
can be kept open.  The occasional arbitrary charset->utf8 just does a
new iconv_open every time.  (On glibc that runs pretty fast.)

Attachment: misc.c
Description: Text Data

Attachment: misc.h
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]