0

I am working on basic HTTP request response example in Android. For this example project, I tried to work with Google Translate URL. However, the characters of other languages are replaced by junk or hex values in the response. If I hit the URL from desktop browser, it works fine.

Here is the code:

httpClient = new DefaultHttpClient();
httpGet = new HttpGet("https://translate.google.com/m?hl=en&sl=en&tl=gu&
    ie=UTF-8&prev=_m&q=sample") ;
httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity() ;
responseString = EntityUtils.toString( httpEntity, HTTP.UTF_8 );
// http response is all good except the characters that are in different 
// language are replaced by hex or junk characters. 

What am I doing wrong? Any help?

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
user3156301
  • 45
  • 1
  • 9
  • 1
    Does the device supports Gujarati font natively? I found out in [this article](http://anirdesh.com/gujarati/add-gujarati-font-in-android.php) that not all devices have native support for Gujarati and some other languages. – Andrew T. Aug 04 '14 at 09:29
  • Will check on that. But I am referring to http response in the string, even before it is displayed on the UI. – user3156301 Aug 04 '14 at 13:47
  • Andrew, it doesn't look like a issue with native fonts. The text render properly on mobile browser. – user3156301 Aug 06 '14 at 07:15

0 Answers0