我的api和json格式如下:
{
status: 200,
messages: "OK",
results: [
{
id: 3,
code: "just_item",
name: "å二æ¡è¥¿ä¸€ä¸ç›®"
},
{
id: 4,
code: "all_item",
name: "å二æ¡è¥¿ä¸€ä¸ç›®"
}
]
}
我想在Android APP中查看文字“å二æ¡è¥ä¸€ä¸ç>®”,如文字“全商品”
答案 0 :(得分:1)
尝试UTF-8编码
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "UTF-8");
params.setBooleanParameter("http.protocol.expect-continue", false);
HttpClient httpclient = new DefaultHttpClient(params);
HttpPost httppost = new HttpPost(Your_URL);
HttpResponse http_response= httpclient.execute(httppost);
HttpEntity entity = http_response.getEntity();
String jsonText = EntityUtils.toString(entity, HTTP.UTF_8);
// your response should appear in proper way
Log.i("Response", jsonText);