Re: [xml] Encoding - from what to UTF8 ??



On Mon, May 23, 2005 at 10:05:50AM +0200, Remy HAREL wrote:
  Yet I also use many others source files encoded with many differents 
encodings :

iso-8859-X ( where X = 1, 2, 5, 6, 14, 15 )
cp1256
gb23xx
Koi8R
cpXXXX ( can't remember the exact name, but it corresponds to Russian ).

  So, my question is "does libxml2 provide functions to convert a 
source text from one of these languages to UTF8, or there is a simple 
way to do that ?"

  The answer is no. Libxml2 has hard coded support for UTF-8, UTF-16 and
the iso-8859-x the 2 first ones being the only mandatory encodings an
XML parser must support. For everything else it uses iconv() if found
at compilation time.
  The API you're looking at is iconv:
    http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.h.html
It's available on all serious OSes, and Igor ships a Win32 precompiled
versions. The set of encoding supported might be platform dependant though
and the quality of the converters may also be system dependant, but 
that's the API to use. There is a free software implementation:
    http://www.gnu.org/software/libiconv/

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://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]