Encoding in Android TextView

后端 未结 3 638
南旧
南旧 2020-12-31 14:09

I\'m new in Android.
When using Json Parsing, I have a problem with display text(maybe cause by font, I don\'t know).
This is my Json return:

{\"Resp         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 14:21

    The problem you are getting actually encoding. So the json string you are getting from your response need to add a proper encoding format. So just do like this.

    Whlie posting a json use like this

    StringEntity strEntity = new StringEntity(Your_json_string, HTTP.UTF_8);
    

    While getting the json object use like this

        if (statuscode == HttpStatus.SC_OK) {
            String responseStr = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
    

提交回复
热议问题