Android JSON CharSet UTF-8 problems
Try the following snippet code which helped me when I was having a similar problem:
new String(jo.getString("name").getBytes("ISO-8859-1"), "UTF-8");
I know this is a couple of years after, but I've come up with a more reliable solution than this one, and it doesn't need all of the encoding extra stuff
This was found by accident while I was looking for something else, but it works:
"" + jo.opt("name");
What this does is get the result as a raw object, and putting it at the end of an empty string forces it into string format - of course, if the entry wasn't originally a string it can give obscure results, so maybe try grabbing it as a string first
I have something like this:
String s = "";try { s = jo.getString("name"); s = "" + jo.opt("name");} catch (Exception e) { Log.e("JSON error", "error:" + e.toString());}
This will test the string exists, and then replace it with the fully encoded version
I hope this helps someone in the future :-)