如何在日语android中查看文本编码

时间:2015-05-30 05:51:19

标签: android json view decode encode

我的api和json格式如下:

{
 status: 200,
 messages: "OK",
 results: [
  {
   id: 3,
   code: "just_item",
   name: "å二æ¡è¥¿ä¸€ä¸ç›®"
  },
  {
   id: 4,
   code: "all_item",
   name: "å二æ¡è¥¿ä¸€ä¸ç›®"
  }
 ]
}

我想在Android APP中查看文字“å二æ¡è¥ä¸€ä¸ç>®”,如文字“全商品”

1 个答案:

答案 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);