Re: [xml] libxml2

On Wed, Jul 06, 2011 at 12:34:03PM +0600, ÐÐÐÐÐÑÐÐÐ ÐÑÐÑÐÐÐ wrote:
I've got a problem with libxml. When I add Cirilic attribute to XMLNode it
converting to UTF-8 and than quot every symbol.

  When you use libxml2 API you must pass only UTF-8 strings when there
is an xmlChar *, if you don't you may see the kind of behaviour you are

It happens in xmlCharEncOutFunc in encoding.c file.
This function quotate UTF-8 of all attributes, but some XMPP servers can't
unquote it and we can get something like ТЕмы&#x447
as a nickname of buddy in our contactlist.

Either those XMPP applications don't use an XML parser to parse XML, or
you made a mistake when using libxml2 made it convert it to that string.
Make sure you are saving to UTF-8 when talking to XMPP too.

paphio:~/XML -> cat tst.xml
<foo attr="&#x422;&#x415;&#x43C;&#x44B;&#x447;"/>
paphio:~/XML -> xmllint tst.xml
<?xml version="1.0"?>
<foo attr="&#x422;&#x415;&#x43C;&#x44B;&#x447;"/>
paphio:~/XML -> xmllint --encode UTF-8 tst.xml
<?xml version="1.0" encoding="UTF-8"?>
<foo attr="ÐÐÐÑÑ"/>
paphio:~/XML ->


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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