After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 101929 - My example
My example
Status: VERIFIED DUPLICATE of bug 101900
Product: libxml2
Classification: Platform
Component: general
2.4.25
Other Windows
: Normal critical
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2002-12-25 02:06 UTC by lxl0621
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description lxl0621 2002-12-25 02:06:29 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 .
Comment 1 Daniel Veillard 2002-12-25 10:56:49 UTC
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 ***