Re: [xml] libxml and encoding's



On Sun, Apr 04, 2004 at 02:06:14AM -0300, Ricardo Markiewicz wrote:
Hi all, first of all excese my english :-P

I have a problem with character enconding and libxml2 (2,6) and i'm
confused.

Reading the "Encoding" section at the web site it say that internally
libxml2 convert all string to UTF8. 

All that happend even if mi XML is declared as :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<a>
  <b próp="cimarrón" />
</a>

  yes, it is transcoded to UTF-8, in all cases !

When i try tu call : xmlGetProp(node, "próp") with node pointing to the
right node "b" ... the function return NULL.

  All the API is UTF-8, you must use the UTF-8 encoding when passing
the name value. And the API won't try to make any guess on what the
encoding of the string you pass might be, it would be far too fragile
*and costly* !

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.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]