我正在尝试解析RSS XML URL,它包含除英语之外的其他语言。我使用UTF-8编码来获得所需的输出,但结果相同
下面是代码:
InputStream in = new URL(rssUrl).openStream();
Reader reader = new InputStreamReader(in,"UTF-8");
InputSource is = new InputSource(reader);
is.setEncoding("UTF-8");
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
SAXParser saxParser = saxParserFactory.newSAXParser();
T handler = null;
handler=handlerClass.newInstance();
saxParser.parse(is, handler);
return handler.getRssItemList();
我还在摆脱各种各样的标签,比如“????? ??? ????” 提前致谢
处理程序代码:
if (isTitle) {
title = new String(ch, start, length);
String result=null;
currentItem.setTitle(title);
}
没有在处理程序代码中执行任何UTF-8操作,只是正常的方式