[xsd-users] Serialization issue with Latin characters

Boris Kolpackov boris at codesynthesis.com
Thu Sep 1 13:54:30 EDT 2011


Hi Justin,

In the future please keep your replies CC'ed to the xsd-users
mailing list as discussed in the posting guidelines:

http://www.codesynthesis.com/support/posting-guidelines.xhtml

Justin Jose <justinjose12002 at gmail.com> writes:

> Hi Boris,
> 
> Thanks alot for your quick reply.
> 
> 
> I tried with the option --char-encoding iso8859-1 and also  --char-encoding
> lsp
> I am not getting the exception now. But the string is still not proper. the
> é is coming as junk.
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <Sample>
>  <Id="Union pour le financement d'Immeubles de Sociétés" />
> </Sample>

This is actually the correct encoding of 'é' in UTF-8. See that
encoding="UTF-8" attribute in the XML declaration? That means the
document is in UTF-8 even though your application internally is
using ISO8859-1. Generally, the input XML encoding, application
encoding, and output XML encoding can all be different.

If you want your XML to also be in ISO8859-1 (by default it is
UTF-8), you will need to specify this encoding when calling one
of the serialization functions, for example:

root (std::cout, obj_model, map, "ISO8859-1");

Boris

[The rest of the original email follows for context.]

> 
>  Didnt find any other encode header files under cxx/xml.
> 
> Another way i can get the correct string?
> 
> Thanks in advance.
> Justin



More information about the xsd-users mailing list