org.springframework.oxm.jaxb.Jaxb2Marshaller umlauts and special characters
How can I marshal开发者_JAVA百科 java string object that contain umlauts by using
org.springframework.oxm.jaxb.Jaxb2Marshaller ?
I have java string like Alizée
.
After marshalling with using Jaxb2Marshaller i get Alizée
xml string.
This can be right, but you are vieving the marshalled XML with the wrong charset (you view UTF-8 as ISO-8859-1/extended ASCII).
I would double-check character encodings and that you are viewing the marshalled XML with the correct encoding.
Example: é is in UTF-8 represented by two bytes: 0xC3
0xA9
http://www.fileformat.info/info/unicode/char/00e9/index.htm
These two bytes, represented in for example ISO-8859-1 will read:
0xC3
: Ã http://ascii-table.com/info.php?u=x00C30xA9
: © http://ascii-table.com/info.php?u=x00A9
If you create a text file containing é and save it as UTF-8
. Re-open the file but choose encoding ISO-8859-1
and you will see the same.
精彩评论