user1021026
user1021026

Reputation:

InputSource text encoding

I have a problem with the encoding of the text. Downloading and parses the xml file. Here, everything works as it should, but the text in the xml file is stored using the encoding ISO-8859-2. To be able to download the file I am using is.setEncoding ("ISO-8859-1") I can not take advantage of is.setEncoding ("ISO-8859-2"), because I get the error coding. Please help.

Upvotes: 0

Views: 2443

Answers (1)

Joop Eggen
Joop Eggen

Reputation: 109597

If I understand correctly the XML text is in ISO-8859-2, but the XML either has no encoding (defaults to UTF-8) or a wrong encoding="UTF8" (probably). This goes wrong if you immediately load it as XML. So you have to load it as text, with ISO-8859-2, and then pass it to the XML API. (Using ISO-8859-1 is not needed or helpful.)

  • Read it as ISO-8859-2 text
  • Pass a string to XML

Upvotes: 1

Related Questions