[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [xml] Available encodings in libxml2



Daniel Veillard:
>   the default supported natively by libxml2 are:
>     - UTF8
>     - UTF16
>     - ISO-8859-1
> 
> Now if compiled with iconv support then you can add the list of encodings
> it can handle, the best is (on linux) to use the command line:
> gnome:~ -> iconv --list

Hmm.  Looks like mine isn't linked with libiconv.

> There is no function at the libxml2 API level to return such list, maybe
> it's part of iconv API.

A couple of weirdnesses though on trying the xmlParseCharEncoding
function.  If I call

  xmlParseCharEncoding("UTF-8")

it returns XML_CHAR_ENCODING_UTF8 as expected.

However, calling

  xmlParseCharEncoding("ASCII")

returns XML_CHAR_ENCODING_ERROR even though I can call

  xmlSaveFileEnc("-", xml_dest, "ASCII")

and it works.

The way I can tell if the encoding doesn't actually work is if I try to
save with that encoding and see if xmlSaveFileEnc returns an error code.
But this means I can't tell if there was an error because the encoding
wasn't available or because the file couldn't be written for some other
reason.

Cameron

-- 
Cameron McCormack
  // clm csse monash edu au
  // http://www.csse.monash.edu.au/~clm/
  // icq 26955922



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]