bauer9664
bauer9664

Reputation: 117

unreadable text in android

In my application I am trying get xml from url and try to do some things. I have 2 language english and russian.

my xml looks like this

<root>
<dictionary>
<element name="english_text" lang="en">
Hello world
</element>
<element name="russian_text" lang="ru">
Привет мир
</element>
</dictionary>
</root>

When parse this xml try to show it, english is fine but russian not.

it is look like this. enter image description here

What is the problem here. please help me

Upvotes: 1

Views: 419

Answers (1)

nsgulliver
nsgulliver

Reputation: 12671

You should use UTF-8 encoding when you try to parse the document in your code, if you have not done that already.

If you are using httpClient for this purpose then it will look like this

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

Upvotes: 4

Related Questions