1

I parse xml file in android. I copypasted example...
It works with english words, but I need to get it working with russian words (it's not working with russion words - without exception - simple bad encoding). I tried to add this

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

It didn't helped me not a little
Xml is in utf-8 encoding. I think, my app translates words in utf-8 to windows1252...
Can somebody please help?

Thanks for edit!)

Example with sourcecode - http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/

Aleksey Makas
  • 123
  • 1
  • 2
  • 18
  • can you post more of your code? Where is the String `xml` filled up? Where is the XML file located? Show us more of what you're doing now, to let us help you. – Marek Sebera Mar 27 '12 at 20:19
  • I add in question link. It's example. I copypast it's all without any sirious edit... – Aleksey Makas Mar 27 '12 at 20:22

2 Answers2

1

It's simple. I get answer from http://forum.sources.ru/index.php?showtopic=354149&st=15&#entry3106098 In English: My app get word from xml in bad encoding!

HttpResponse httpResponse = httpClient.execute(httpPost);
                HttpEntity httpEntity = httpResponse.getEntity();
                line = EntityUtils.toString(httpEntity, "UTF-8");

Simple, I must add encoding in moment, when i get word!

Aleksey Makas
  • 123
  • 1
  • 2
  • 18
0

try using ISO-8859-5 encoding instead of UTF-8 (also in your post it's written UTF*_*8 - are you sure about that??? )

mihail
  • 2,173
  • 19
  • 31