Rafael Sousa (Ext_Altior) wrote:
Hi all!
When running the samples in the Xerces-C++ library, namely SAX2Count (with validation), I get the following error:
Warning at file /home/rsousa/XML_Schema.xsd, line 1, char 40
Message: Encoding (UTF-16, from XMLDecl or manually set) contradicts the
auto-sensed encoding, ignoring it
In XML_Schema.xsd, the first line is:
<?xml version="1.0" encoding="UTF-16"?>
Are you sure the file is actually encoded in UTF-16? Why don't you try
another parser, or examine the file with a binary editor to verify that
the file is encoded in UTF-16, and has the correct BOM (byte order mark).
If I replace it with UTF-8, no error occurs. But I really need UTF-16...
Replace what? Do you mean you change the encoding declaration in the
document to UTF-8 and Xerces doesn't complain? Just changing the
encoding declaration doesn't change the actual encoding of the file. It
sounds to me like your document is encoded in UTF-8.
Does anyone know why does this happen? Shouldn't Xerces-C++ automatically use
UTF-16 encoding?
Yes, and I've never seen this problem before.
Dave