Sax Parser Doesn't Recognize Windows-1255 Encoding
I'm working on a rss parser in android (upgrading a parser I found on the internet). From what I know SAX Parser recognize the encoding automatically from the xml tag, but when I
Solution 1:
Chances are the platform itself doesn't know about the "windows-1255" encoding. After all, it's a Windows-based encoding - I wouldn't want to rely on it being available on any other platforms, particularly mobile ones where things are generally cut down to the "must-have" options.
Solution 2:
You need to set the encoding to the InputStreamReader.
Readerisr=newInputStreamReader(feed, "windows-1255");
finalInputSourcesource=newInputSource(isr);
From javadoc the logic for reading from InputSource goes something like this:
- Is there a character stream? if there is, use that(This is what happens if you use a Reader like InputStreamReader)
Otherwise:
- No character stream? Use byte stream. (InputStream)
- Is there a encoding set for InputSource? Use that
- There was no encoding set? Try parsing the encoding from the xml file
Post a Comment for "Sax Parser Doesn't Recognize Windows-1255 Encoding"