I am trying to parse an XML file containing Hebrew characters. I know that the file is correct, because if I output the file (from other software) without Hebrew characters, it is perfectly parsed.
I tried a lot of things but always get this error
MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
My last attempt was to open it using FileInputStream and specify the encoding
DocumentBuilder db = dbf.newDocumentBuilder(); document = db.parse(new FileInputStream(new File(xmlFileName)), "Cp1252");
( Cp1252 is the encoding that worked for me in another application) But I got the same result.
Tried to use ByteArray , nothing worked.
Any suggestions?
source share