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
donot use try{} catch in the onResponse block, that is giving some problem in my code , rather than that you can implement like this .
@Override
onResponse(String s) {
s= fixEncoding(s);
Toast.makeToast(this,s,Toast.LENGTH_LONG).show();
}
and i think you will get the required result
public static String fixEncoding(String response) {
try {
byte[] u = response.toString().getBytes(
"ISO-8859-1");
response = new String(u, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
return response;
}