Android - 用俄语单词解析xml(编码)

问题描述 投票:1回答:2

我在android中解析xml文件。我复制的例子...... 它适用于英语单词,但我需要使用俄语单词(它不会使用russion单词 - 无一例外 - 简单的错误编码)。我试着添加这个

InputSource is = new InputSource();
is.setEncoding("UTF_8"); //add this
is.setCharacterStream(new StringReader(xml));
doc = db.parse(is); 

它没有帮助我一点点 Xml是utf-8编码。我想,我的应用程序将utf-8中的单词翻译成windows1252 ... 有人可以帮忙吗?

谢谢你的编辑!)

源代码示例 - qazxsw poi

java android xml parsing encoding
2个回答
1
投票

这很简单。我从http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/得到答案英文:我的应用程序从错误编码的xml中获取单词!

http://forum.sources.ru/index.php?showtopic=354149&st=15&#entry3106098

很简单,当我得到消息时,我必须在片刻中添加编码!


0
投票

尝试使用HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); line = EntityUtils.toString(httpEntity, "UTF-8"); 编码而不是ISO-8859-5(也在你的帖子中写的UTF * _ * 8 - 你确定吗???)

© www.soinside.com 2019 - 2024. All rights reserved.