I know that this should be fundamental, but I didn’t have an education :( And I do not understand this, everywhere it seems obvious to people. I get that one side is encoding data with its set, and the android is probably expecting the other, but what can I do to translate?
My application runs a receive request on the Google Maps api to get the address from Lat / lng. But I could not decode the result correctly, as the French è is displayed as è
I am missing xp in Java to figure out what to do. This is due to UTF-8, right?
What should I do?
response = client.execute(httpGet); HttpEntity entity = response.getEntity(); InputStream stream = entity.getContent(); int b; while ((b = stream.read()) != -1) { stringBuilder.append((char) b); } JSONObject jsonObject = new JSONObject(); jsonObject = new JSONObject(stringBuilder.toString()); retList = new ArrayList<Address>(); if("OK".equalsIgnoreCase(jsonObject.getString("status"))){ JSONArray results = jsonObject.getJSONArray("results"); for (int i=0;i<results.length();i++ ) { JSONObject result = results.getJSONObject(i); String indiStr = result.getString("formatted_address"); Address addr = new Address(Locale.ITALY); addr.setAddressLine(0, indiStr); Dbg.d(TAG, "adresse :"+addr.toString()); retList.add(addr); } }
Thanks for the help!
source share