UTF-8 encoding in Volley Requests

后端 未结 8 1472
天命终不由人
天命终不由人 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:44

    Add this line of code inside response of volley :

     public void onResponse(String response) 
        {
    
         if (response != null) 
          {
            response=new String(response.getBytes("ISO-8859-1"), "UTF-8");
          }
       }
    

提交回复
热议问题