0

I'm trying to decode a XML using XmlPullParser with UTF-8 but something is going wrong because when a string is "dirección" I am getting "direcci& #xf3;n" (without spaces between & and #).

I did this:

            XmlPullParser parser = Xml.newPullParser();
            parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
            parser.setInput(input, "UTF-8");

Also I tried with parser.setInput(input, "utf-8"); but same problem

What I am doing wrong?

halfer
  • 19,824
  • 17
  • 99
  • 186
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
  • Whats the difference in your strings? Aren't they same? – waqaslam Apr 23 '15 at 09:06
  • There is having the simplest example for XMLPullParser with UTF-8 in this Url which also i followed :http://www.javatpoint.com/android-XMLPullParser-tutorial – Rajan Bhavsar Apr 23 '15 at 09:06
  • waqaslam i edited my question – NullPointerException Apr 23 '15 at 09:09
  • I don't think this is a problem with UTF-8 specifically. I think this is a problem with the parser turning special characters into HTML entities. If there were a charset problem, I would expect to see some garbled text or ? symbols. Have you tried something like: StringEscapeUtils.unescapeHtml(xml); (Apache Commons) – Knossos Apr 23 '15 at 09:21

0 Answers0