I am trying to get a json from my server to my android through java. I have written the json using my C# app, and checked in Sublime 2, all was fine, uploaded to server, and downloaded back, retried to open, and all was fine again. But when i do the same on android, i get some weird characters. For example, every letter with accent becomes '?'. This is the code i m using to download
RequestQueue queue = Volley.newRequestQueue(context);
StringRequest request = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText (MyApplication.getAppContext(), response, Toast.LENGTH_LONG).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
queue.add(request);
I have also tried using this code:
new String(pangtee.getString("body").getBytes("ISO-8859-1"), "UTF-8");
but neither this does the work properly.
I have seen this question: StackOverflow, but this uses php, do i have to write in php?, isn't there any way without it? I'm C# and Java dev, it will be my very first time on php.
This is an example of the file it has to download.
{
"char1": "òàùèé",
"char2": "ò"
}
The response contains some times '?', some other times '�', and some other times other characters, like è => "é"; ì => "ì"