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



On Tue, 2004-05-04 at 18:52 +0000, Murray Cumming wrote:
> > My probably stupid question is the following:
> > Murray, in ustring::ustring(const char* src, ustring::size_type n), is "n" supposed to be the length in utf-8 characters, or in bytes ?
> 
> I think it's meant to be the number of characters. That's not what I'd
> expect, but I guess it makes sense in terms of translating std::string
> to Glib::ustring.
> 
> Actually, in my debugger, the ch paramater to
> SaxParserCallback::characters() seems to be 0, which is a more likely
> cause for the crash. I guess we should check for 0.

Hmm, my debugger seems to be broken. It's a new system.

Rather than getting the number of characters and then giving that to the
ustring constructor to convert back to number of bytes, I suggest we put
the string in a std::string and just use the Glib::ustring(std::string)
constructor. I can't see a more suitable ustring constructor.








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