GNOME Bugzilla – Bug 101929
My example
Last modified: 2009-08-15 18:40:50 UTC
I'm sorry for sending duplicate bug and no complete example.Now I specify it. book.xml <?xml version="1.0" encoding="gb2312"?> <!DOCTYPE book SYSTEM 'book.dtd' > <book> <Ãû×Ö>ÊéÃû</Ãû×Ö> <writer>lxl</writer> </book> book.dtd <?xml version="1.0" encoding="gb2312"?> <!ELEMENT book (Ãû×Ö|writer£©> <!ELEMENT Ãû×Ö (#PCDATA)> <!ELEMENT writer (#PCDATA)> Then I use "xmllint book.xml " in the libxml2-2.4.26 and type "xpath ancestor-or-self::Ãû×Ö" or "xpath /book/Ãû×Ö" ,the result is "xpath error Encoding error ". But if I type "xpath ancestor-or-self::writer" or "xpath /book/writer" ,that is OK. There is the same problem in xpointer. I consider libxml2 cann't support Chinese when using xpath and xpointer.Do you think so ?Thank you .
DO NOT CREATE A NEW BUG !!! THERE IS NO BUG IN THIS EXAMPLE. YOU MUST USE THE UTF-8 ENCODING FOR YOUR XPATH QUERIES YOUR XPATH QUERIES USE gb2312 for the name encoding THIS WILL NOT WORK LIBXML2 supports the full unicode range BUT YOU MUST EXPRESS YOUR XPATH QUERIES IN UTF-8 CAN YOU UNDERSTAND THAT ??? "ancestor-or-self::Ãû×Ö" is an XPath query encoded in gb2312 This WILL NOT WORK because as I pointed in previous mail http://xmlsoft.org/encoding.html the internal representation of libxml2 is UTF-8 You MUST convert this query to use UTF8 ! THIS IS NOT A BUG. LIBXML2 support chinese documents. The XPath queries do work on chinese documents and characters BUT THOSE QUERIES MUST BE encoded in UTF-8, NOT in gb2312 or anything else !!! I won't repeat it another time !!! Daniel *** This bug has been marked as a duplicate of 101900 ***