0

I have rest webservice that it's programmed in Visual Studio Asp.net project. i want to send Array of String that contain Hebrew language to Android project

In visual studio i only write return array;

In Android i write:

HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI(url));
HttpResponse response = client.execute(request);
HttpEntity responseEntity = response.getEntity();
xml = EntityUtils.toString(responseEntity7, HTTP.UTF_8);  
return xml;

but the problem is that in the Android project i get "??????" instead of Hebrew words i guess the problem is in the encoding.

Thanks

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
user1245809
  • 153
  • 1
  • 6
  • [Read an XML file with HTTP GET](http://stackoverflow.com/questions/3395154/android-read-an-xml-file-with-http-get) – Ali Jul 28 '12 at 10:18

1 Answers1

0

You are toStringing the entity in UTF_8 format, which is all well and good, but you need to set the encoding of your HTTP response. You can either do so directly here in code:

HttpResponse.ContentEncoding = System.Text.UTF8Encoding;

Or you can do it globally:

<configuration>
  <system.web>
    <globalization
      fileEncoding="utf-8"
      requestEncoding="utf-8"
      responseEncoding="utf-8"
    />
  </system.web>
</configuration>
Jaime Torres
  • 10,365
  • 1
  • 48
  • 56