Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] invalid byte 2 of 3 byte UTF-8 error received

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Sandy Mustard <smustard AT cinci.rr.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] invalid byte 2 of 3 byte UTF-8 error received
  • Date: Mon, 23 Sep 2013 20:15:41 -0400

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&#x0A;Senior project manager&#x0A;forteq Czech&#x0A;Kopisty 1- areal MUS,a.s.&#x0A;CZ - 43401, Most - Kopisty&#x0A;Tel: +420 476 203 826&#x0A;Fax: +420 476 203 835&#x0A;Mobil: +420 602 109 446&#x0A;" />

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




Archive powered by MHonArc 2.6.24.

Top of Page