Android : String and JSONArray are not display the same way in debugger

on Thursday, April 2, 2015


I am trying to understand the text difference I am getting while debugging in Android studio. It seems that the watcher is not able to show UTF-8 string. Here is the code :



static public JSONArray CreateStationsJson(HttpEntity page) throws IOException, JSONException
{
String getText = EntityUtils.toString(page, HTTP.UTF_8);
JSONArray js = new JSONArray(getText);
return js;
}


And here are the watch result if I put a break point on the return statement:


-getText :[{"id":"1","meteomediaID":"caqc1304","snow1":"Pr\u00e8s de 5 cm"...


-js : [{"id":"1","meteomediaID":"caqc1304","snow1":"Près de 5 cm"...


You can note that the json displays correctly the accent but the string doesn't. What is the reason behind that ?


Thanks for your time.


0 comments:

Post a Comment