Re: [xml] encoding question



On Tue, Mar 25, 2003 at 10:44:28AM +0100, Klaus Dittrich wrote:
I am an absolute beginner to xml and started using libxml2-2.5.4 and
became confused about the handling of enconding.

As far as I understood the documentation libxml honours the encondig
given in the document header. (<?xml version="1.0" encoding="ISO-8859-1"?>)
for a set of default encodings. (UTF-16, ISO-8859-1, ASCII, UTF-8 to ASCII
with HTML)
  
If such header is given and iconv is present, which is the case when 
using glibc, the conversion for input and output data to and from
the internally used UTF-8 encoding is done by libxml2 and has not to
be done by me. 

Am I right with this ?

  Hum, to avoid any misinterpretation:
    - when parsing and saving, yes the convertion is done automatically
    - BUT all the APIs based on parsed document must all use UTF-8,
      i.e. if you want to add content to a document you must convert
      all the strings added first to UTF8, if you don't libxml2 won't
      check but will fail to save the document.

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]