Re: [xml] problem with accents



Lafragueta Arnaud wrote:
Hello,

I have a question about libxml2:

when i use xmlParseMemory (buffer, strlen(buffer));

the accents (éèàô...) who were in my buffer aren't anymore in the result
of this method.

Sure they are - provided the string is in UTF8 encoding as required by
the libxml API.

How can i do to keep them or to tranform them before the parsing?

If your string is in latin-1 encoding, libxml provides function to
encode latin-1 into utf-8 (and vice versa).  Otherwise, look into using
iconv() or similar functionality.
Alternatively, write your XML to a file with a suitable encoding set in
the XML declaration and parse from that file - then libxml will (try to)
handle encoding issues.





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