解析rss和atom文件出现乱码问题
try { String xmlString = new String(response.data, Charset.forName("UTF-8")); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser xmlPullParser = factory.newPullParser(); xmlPullParser.setInput(new StringReader(xmlString)); return Response.success(xmlPullParser, HttpHeaderParser.parseCacheHeaders(response)); } catch (XmlPullParserException e) { return Response.error(new ParseError(e)); }
Charset字符集指定utf-8,将返回的字符串重新编码就不会出现乱码了