UTF-8 encoding in Volley Requests

后端 未结 8 1507
天命终不由人
天命终不由人 2020-12-06 02:17

In my Android app I am loading json data with a Volley JsonArrayRequest. The data were created by myself and I saved them with Sublime with UTF-8 encoding. When

8条回答
  •  长情又很酷
    2020-12-06 02:30

    I have same problem like this and i solve it using UTF-8 charset.

    String str = "";
    try {
         str = new String(strFromService.getBytes("ISO-8859-1"), "UTF-8");
    } catch (UnsupportedEncodingException e) {
    
     e.printStackTrace();
    }
    
    String decodedStr = Html.fromHtml(str).toString();
    

    I hope this will work for you

提交回复
热议问题