Re: [xml] DOM: specifying input encoding



On Fri, Aug 31, 2001 at 06:04:54PM +0200, Heiko Rupp wrote:
Hello,

is there a (simple) way to tell libxml that
a value given to xmlSetProp() or content given to
xmlNewChild() is actually not in UTF-8 but e.g.
iso-8859-1 and that xmlNewChild/xmlSetProp
should translate it on the fly?

  No there is no such API, libxml expects the input to be UTF-8 for
tree manipulations.
  Considering the fact that opening a new language encoder may be
costly (need to load a shared lib if using one of the iconv supported
encodings on Linux for example) it's more coherent to have the 
user level use (and reuse) such an encoder than to open/convert/close
an encoder for every properties set. The API you suggest is unfortunately
not very easy to implement properly (and reuse of encoders may be a
problem because they are in a number of case stateful and it's not possible
to guess in advance if reusing them for multiple successive encoding is
possible or not).

  I considered this, and decided it would not make much sense in general,

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
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]