Re: [xml] Trouble with UTF-8



On Mon, Aug 01, 2005 at 08:38:08AM -0400, Aaron Walker wrote:
If I run the program, and use xmlUTF8Strsub(ch,0,len) in the characters
callback (using the SAX2 interface, btw), it truncates the string before the
character.

  I don't understand, provide standalone code reproducing the problem.

It also looks like the callback is called twice if the xmlChar*
contains a UTF8 char, with the string being truncated before the char on the
first one and everything afthe UTF8 char on the second one.  To see what I'm

  That is allowed, nothing garantee in the SAX interface that you will get
a single callback per text node, this is a streamable interface, the client
level must be able to stream too for various reasons. If SAX2 is too hard
for you, don't use it, use the reader !

I was able to make a teensie amount of progress, using the resulting length
returned by xmlGetUTF8Char(), but this only worked on the first name (since it
was the last char).  Am I at least heading in the right direction here?

  I don't understand.

How can I go about getting the final string I'm looking for?

  Concatenate the callbacks if you can't process in a stream fashion.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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