Sandy Mustard
2013-09-24 00:15:41 UTC
I have some text that I need to convert to xml. The text is:
"Ing. Libor Vos\xe1hlo\nSenior project manager\nforteq Czech\nKopisty 1-
areal MUS,a.s.\nCZ - 43401, Most - Kopisty\nTel: +420 476 203 826\nFax:
+420 476 203 835\nMobil: +420 602 109 446\n"
I am converting the "\n" sequences to new lines (x0a).
Note the character sequence that is \xe1. I convert this sequence with
a character with a value of 225 (xe1).
I am using XOM to create the XML
Attribute attr = new Attribute("Text", textString);
xmlClass.addAttribute(attr);
and here is the output:
<MyElem Text="Ing. Libor Vos?hlo
Senior project manager
forteq
Czech
Kopisty 1- areal MUS,a.s.
CZ - 43401, Most -
Kopisty
Tel: +420 476 203 826
Fax: +420 476 203
835
Mobil: +420 602 109 446
" />
Note the correct last name in the data (with the ?)
However, when reading this in various XML parsers, I get a
"java.io.UTFDataFormatException: Invalid byte 2 of 3-byte UTF-8
sequence" error.
How do I pass this string to XOM to get the correct UTF-8 encoding?
Thank you.
Sandy Mustard
"Ing. Libor Vos\xe1hlo\nSenior project manager\nforteq Czech\nKopisty 1-
areal MUS,a.s.\nCZ - 43401, Most - Kopisty\nTel: +420 476 203 826\nFax:
+420 476 203 835\nMobil: +420 602 109 446\n"
I am converting the "\n" sequences to new lines (x0a).
Note the character sequence that is \xe1. I convert this sequence with
a character with a value of 225 (xe1).
I am using XOM to create the XML
Attribute attr = new Attribute("Text", textString);
xmlClass.addAttribute(attr);
and here is the output:
<MyElem Text="Ing. Libor Vos?hlo
Senior project manager
forteq
Czech
Kopisty 1- areal MUS,a.s.
CZ - 43401, Most -
Kopisty
Tel: +420 476 203 826
Fax: +420 476 203
835
Mobil: +420 602 109 446
" />
Note the correct last name in the data (with the ?)
However, when reading this in various XML parsers, I get a
"java.io.UTFDataFormatException: Invalid byte 2 of 3-byte UTF-8
sequence" error.
How do I pass this string to XOM to get the correct UTF-8 encoding?
Thank you.
Sandy Mustard