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?

4
  • Whats the difference in your strings? Aren't they same? Commented Apr 23, 2015 at 9:06
  • There is having the simplest example for XMLPullParser with UTF-8 in this Url which also i followed :javatpoint.com/android-XMLPullParser-tutorial Commented Apr 23, 2015 at 9:06
  • waqaslam i edited my question Commented Apr 23, 2015 at 9: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) Commented Apr 23, 2015 at 9:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.