简体   繁体   中英

How to view text encode in Japanese android

I have a api and json format like bellow:

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

I want to view text "å二æ¡è¥¿ä¸€ä¸ç›®" in Android APP like text "全商品"

try UTF-8 encode

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM