Re: [libxml++] program crashes when parsing XML with accent



On Tuesday 04 May 2004 18:25, Murray Cumming wrote:
> On Tue, 2004-05-04 at 14:13, Frederik Himpe wrote:
> > I have an XML document in ISO-8859-1 character set. When using
> > libxml++-2.6, the sax pasers crashes when it encounters a character with
> > an accent (é) in the on_characters method. I'm using the Glib::ustring
> > class.
>
> Glib::ustring should contain a UTF8 string. It can not recognise your
> encoding and convert by itself. I think you need to use some conversion
> API such as iconv or the glibmm convert functions.

Should not libxml++ do this conversion? I'm only receving a Glib::ustring in 
the on_characters function of the sax parser, so the problem happens already 
somewhere in libxml++ itself, which seems to be confirmed by the stack trace 
if I understand it correctly.

I now tried saving the document in UTF-8 with gedit. The é character is now 
translated in hexadecimal c3 a9, which seems to be correct. vim shows again 
the two strange characters, but that's probably because my locale is not set 
to UTF-8. Processing this file with libxml++-2.6, still crashes the 
application with the same back trace.

Another thing I do not understand: libxml++-1.0 uses std::string, but it seems 
these std::strings contained UTF-8. Is that possible?

Thanks for the help,
-- 
Frederik Himpe




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