Encoding in Android TextView

后端 未结 3 637
南旧
南旧 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:17

    I fixed it. My problem is UTF-8 charset.

    String name = "";
    try {
        name = new String(c.getString("NAME").getBytes("ISO-8859-1"), "UTF-8");
    } catch (UnsupportedEncodingException e) {
    
        e.printStackTrace();
    }
    
    String decodedName = Html.fromHtml(name).toString();
    

提交回复
热议问题