org.xml.sax.SAXParseException: Invalid byte 2 of 3-byte UTF-8 sequence

abhijith501 picture abhijith501 · Oct 26, 2012 · Viewed 21.8k times · Source

I am encountering the above error in production environment whereas the process went fine in UAT.

I was wondering whether this error is related to jar file loading. We are using webmethods and the above error occurred for a java service.

Answer

Jim Garrison picture Jim Garrison · Oct 26, 2012

The most likely scenario is that the file is ISO-8859-1 encoded and contains extended ASCII (characters between 0x80 and 0xff inclusive). The parser is expecting UTF-8 and one of the extended characters is being interpreted as the start of a 3-byte sequence, but is not followed by a byte that is valid in that position.