Java android中的Unicode RSS问题
我使用此代码以Unicode(阿拉伯语)文本显示RSS,但结果如下所示:Java android中的Unicode RSS问题,java,android,xml,unicode,rss,Java,Android,Xml,Unicode,Rss,我使用此代码以Unicode(阿拉伯语)文本显示RSS,但结果如下所示: لقاء منسقى المهرجان 而真正的文本是 ل 我的代码: public
لقاء منسقى المهرجان
而真正的文本是
ل
我的代码:
public void getDataFromFeed(){
try {
Feed = new URL(URLFeed);
DocumentBuilderFactory dbf= DocumentBuilderFactory.newInstance();
db = dbf.newDocumentBuilder();
doc = db.parse(new InputSource(Feed.openStream()));
doc.getDocumentElement().normalize();
nodeList = doc.getElementsByTagName("item");
title = new String[nodeList.getLength()];
pubDate = new String[nodeList.getLength()];
link = new String[nodeList.getLength()];
for(int i=0;i<nodeList.getLength();i++){
Node node = nodeList.item(i);
Element fstElmnt = (Element) node;
NodeList titleList = fstElmnt.getElementsByTagName("title");
Element titleElement = (Element) titleList.item(0);
titleList = titleElement.getChildNodes();
title[i] = ((Node) titleList.item(0)).getNodeValue();
NodeList pubDateList = fstElmnt.getElementsByTagName("pubDate");
Element pubDateElement = (Element) pubDateList.item(0);
pubDateList = pubDateElement.getChildNodes();
pubDate[i] = ((Node) pubDateList.item(0)).getNodeValue();
NodeList linkList = fstElmnt.getElementsByTagName("link");
Element linkElement = (Element) linkList.item(0);
linkList = linkElement.getChildNodes();
link[i] = ((Node) linkList.item(0)).getNodeValue();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void getDataFromFeed(){
试一试{
Feed=新URL(URLFeed);
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
db=dbf.newDocumentBuilder();
doc=db.parse(新的InputSource(Feed.openStream());
doc.getDocumentElement().normalize();
nodeList=doc.getElementsByTagName(“项目”);
title=新字符串[nodeList.getLength()];
pubDate=新字符串[nodeList.getLength()];
link=新字符串[nodeList.getLength()];
对于(inti=0;i这是使用urlcoder对url进行编码的问题。例如,encode
URLEncoder.encode(Url,“UTF-8”)