[Top][All Lists]

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

Re: charset conversion

From: Christian Mauduit
Subject: Re: charset conversion
Date: Fri, 10 Feb 2006 21:30:16 +0100
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051018)


William Xu a écrit :
>>I did some bits for my charting program, converting to and from utf8
>>using the libc iconv() stuff (plus some ascii-only fallbacks).  You
>>could also run the iconv command-line program from within guile if you
>>don't want C code, and only have a few bits to convert.
> Hmm, yeah, a scheme wrapper around iconv() works okay. Thanks.

BTW (not extactly your question, but it's related) in my program ( ) I use a wrapper over gettext (
see src/funcs.c for code snippets). The idea is to handle charset
conversions through gettext. I also use a quirk & dirty shell script:



find $SCRIPT_DIR -type f -a -name "*.scm" \
    | xargs sed "s/^.*( *_  *\\(\\\".*\\\"\\) *).*\$/_(\1)\; \\/\\/
extracted by" \
    | grep \
    > $C_FILE

to create a .c file which can then be processed by gettext tools. The
idea is to create a dummy C file with contents like:

_("my string");      // extracted by

whenever there's a line in a scheme file with a construct of the form

(_ "my string")

This file is never compiled but gettext tools parse it, and this way you
can use a po-style translation system for you Guile strings. This is
lightweight code but it provides me with a translating framework which
is "scheme-enabled" and very similar to what usually happens in C.

It's easy to use: whenever you want something to be translated, and not
bother about charsets, simply replace:

"your string"

with the form:

(_ "your string")


Have a nice day,


Christian Mauduit <address@hidden>     __/\__ ___
                                        \~/ ~/(`_ \   ___                   /_o _\   \ \_/ _ \_ (GnuPG)    \/      \___/ \__)

reply via email to

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