[xsd-users] Serialization and extended ascii characters.

Boris Kolpackov boris at codesynthesis.com
Fri Jun 6 08:16:41 EDT 2008


Hi Jan,

jan.noorland at iff.com <jan.noorland at iff.com> writes:

> I'm trying to serialize an object model to XML where one of the string 
> values
> can contain extended ascii characters
> 
> Example:        Instantáneas
> 
> The serialization code throws an exception on the á character.
> 
> Is there a way to solve this?

I tend to think (without knowing which exception is thrown) that 
this is happening because XSD-generated code with character type
'char' expects the text in UTF-8 encoding. So you will need to
make sure that the 'á' character in your string is encoded as
UTF-8 multibyte sequence.

Alternatively, you can try to instruct the generated code to assume
that text is in the local code page by compiling your application
with XSD_USE_LCP macro defined. This approach, however, is not
portable in the sense that you cannot control the local code page
on some platforms (notably, Windows).

For more information see Q 1.2 in the C++/Tree Mapping FAQ:

http://wiki.codesynthesis.com/Tree/FAQ

Boris




More information about the xsd-users mailing list