Re: [libxml++] UTF-8



Thank you verry much.

Using Glib::locale_to_utf8("valeur avec é etc"), it works fine.

2007/6/20, Matthias Wimmer <m tthias eu>:
Fabian Jacquet schrieb:
> I have a problem with utf-8. I'm using personal compilation of GLibmm
> 2.12.10
> Here is my code:
[...]
>     n->set_attribute("att1","valeur avec é etc","");
>     n->set_attribute("att2","valeur avec ê etc","");
>     n->set_attribute("att3","valeur avec   etc","");
[...]
> Remarks about output file:
>
>     * No UTF-8 header "0xEF BB BF"

There is not need for UTF-8 files to start with these bytes, in fact it
is very uncommon outside the MS Windows platform to have a zero width
non-breaking space at the beginning.

>     * "é etc" is coded like this "0xE9 A0 A5 74 63". I think 0x20 is
>       missing for the space, I'm not sure "é" is correctly coded, "e"
>       from "etc" is missing
>     * "ê etc" is coded like this "0xEA A0 A5 74 63". Same remarks
>     * "  etc" is coded like this "0x20 20 65 74 63"

Are the strings in your C code encoded using the UTF-8 character set?
Using these string constants won't work if they are encoded in anything
else (e.g. ISO-8859-1).

> Did I do any error in my code?

Best you would edit the C files and compile them in a locale that has
UTF-8 at the charset. Else you either have to convert the strings to
UTF-8 before passing them to libxml++ or store at least the character
constants in your C file in UTF-8.


Matthias



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