[xsd-users] Serialization and accent

Boris Kolpackov boris at codesynthesis.com
Fri Feb 26 03:01:40 EST 2010


Hi Julien,

Julien KHONG <julienkhong at yahoo.fr> writes:

> When i try to serialize the value "système" to a file, i get an exception
> 
> CharsetTest ct("système");

By default the character data in the object model is encoded in UTF-8.
That is, when an XML file is parsed into the object model, all the text 
data is converted to UTF-8. Similarly, when the object model is serialized
to XML, the text data is expected to be in UTF-8. So the 'è' letter has to
be represented as a two-byte pair:

CharsetTest ct("syst\xC3\xA8me");

Alternatively, you cat upgrade to XSD 3.3.0.b1 (see the download page[1],
the final release should be out mid-March) which not provides the 
--char-encoding option. If you specify:

--char-encoding iso8859-1

Then your code should work without any modifications.

[1] http://www.codesynthesis.com/products/xsd/download.xhtml

Boris



More information about the xsd-users mailing list