[xml] Problem with xmlDocDumpMemory and UTF-16



Running on Windows with version 2.5.6 without iconv.

I have a document on disk in Unicode with Byte Order Marks which I read in
using xmlParseFile. This correctly works out that the document is encoded in
UTF-16LE whether the encoding declaration specifies UTF-16 or UTF-16LE,
although the element member in the xmlDoc structure contains whatever the
encoding declaration specified.

Using xmlDocDumpMemory if the encoding declaration specified UTF-16LE works
fine. If the encoding declaration specified UTF-16 it fails, I think because
it couldn't decide what encoding handler to use.

Using xmlDocFormatDump if the encoding declaration specified UTF-16LE works
fine, although it doesn't output Byte Order Marks. If the encoding
declaration specified UTF-16, it outputs the document in UTF-8 and doesn't
include an encoding declaration.

My particular problem is with xmlDocDumpMemory failing where the document
specifies UTF-16. Am I missing the point somewhere? Is this a bug?

I can work around it by creating an alias for UTF-16LE of UTF-16, but this
doesn't look like a very sensible idea to me although I'm not sure why.

Any help will be welcome,

Thanks,

Mark.




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