[gcompris-devel] XML and accents
Bruno Coudoin
bcoudoin at anfora.fr
Sun Nov 25 06:31:03 UTC 2001
I agree that it is usefull to boards code to have this handled in
gcompris core. I wanted to do it by the time I found the way to handle
that but you're faster than me ;)
You can include your code in the cvs.
On a similar topic, I have a problem with the language selection. It
happens that I did not find a way to dinamycally change the locale
except for what we take from the xml files.
In one word, I can't have gettext change its locale dynamically.
If somebody has an idea ..
Bruno.
le sam 24-11-2001 à 21:32, pgeorges a écrit :
> Bruno Coudoin a écrit :
> >
> > Pascal, you need to look at my code in gameutil.c and do the same in
> > your xml parsing. there is some clue to do that by using UTF8Toisolat1.
> >
> > It has worked for me ;)
> >
> > Bruno.
>
> Great, it also works for me. But what happens if the user language is
> not an isolatin1 ? Does the code in gameutil.c handles this properly
> (conversion is done regardless of lang) ?
>
> As this is a useful conversion, maybe it should be a helper one
> avalaible in gameutil.c. Here is a blueprint (I don't include it
> directly, as I don't master at all the subject):
>
> /* ==================================== */
> static gchar * convertUTF8Toisolat1(gchar * text) {
> #define MAX_LENGTH 128
> const char *inptr;
> size_t inleft;
> char *outptr;
> size_t outleft;
> gint retval;
> // this should never happen, it does often with my XML parsing !!
> if (text == NULL)
> return NULL;
>
> inptr = (const char *) text;
> outptr = (char *) g_malloc(MAX_LENGTH);
> inleft = xmlUTF8Strsize(text, MAX_LENGTH);
> outleft = MAX_LENGTH;
> // Conversion to ISO-8859-1
> retval = UTF8Toisolat1(outptr, &outleft, text, &inleft);
> if(retval==0) {
> g_free(text);
> text = outptr;
> text[outleft]='\0';
> } else
> g_free(outptr);
>
> return text;
> }
>
> _______________________________________________
> gcompris-devel mailing list
> gcompris-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gcompris-devel
--
Bruno Coudoin
ANFORA - http://www.anfora.fr
Tel: (33)5 61 00 34 67
More information about the Gcompris-devel
mailing list