I am trying to parse a bytearray which contains a string Impresión
in XML
final DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
final DocumentBuilder builder = builderFactory.newDocumentBuilder();
final Document document;
try (final InputStream stream = new ByteArrayInputStream(bytearray)) {
document = builder.parse(stream); // gives Invalid byte 2 of 4-byte UTF-8 sequence error
}
It produces Invalid byte 2 of 4-byte UTF-8 sequence error. But when i have Unicode Impresi\u00f3n
, it works fine. But i want to parse actual character.
Anybody help me to solve it.