[xsd-users] iso-8859-1 - Serialization Error

Boris Kolpackov boris at codesynthesis.com
Wed Apr 22 06:09:11 EDT 2009


Hi Constantin,

Constantin Iacobescu <sir.costy at gmail.com> writes:

> exception: xsd::cxx::xml::invalid_utf8_string 
>
> [...]
>
> 
>        project.setDesc("óáé");

When you use char as the character type (default), the text in the 
object model is expected to be in UTF-8. What happens here is you
pass a string containing characters that are in another encoding
(ISO-8859-1) and which happen to be invalid in UTF-8. That's why
you get the invalid_utf8_string exception during serialization.

One thing that you can try (apart from converting your strings
to UTF-8) is to recompile your application with the XSD_USE_LCP
macro defined which will make the object model assume text is
in the local code page. What that means exactly depends on the
operating system. See Q&A 1.2 in the C++/Tree Mapping FAQ for
details:

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

Boris




More information about the xsd-users mailing list