我正在开发Android中的基本HTTP请求响应示例。对于此示例项目,我尝试使用Google翻译网址。但是,响应中的其他语言的字符将替换为垃圾或十六进制值。如果我从桌面浏览器中点击URL,它可以正常工作。
以下是代码:
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.
我做错了什么?有帮助吗?