I'm sending information from Android to a PHP WebService through the Volley lib. Everything works perfectly except with special characters.
Map<String, String> params = new HashMap<String, String>();
params.put("nome", "áàâãõóòúç");
If the name is equal to - nome = Maria das Graças
for example, it gives me this error:
Error output:
W / System.err: org.json.JSONException: End of input at character 0 of
W / System.err: at org.json.JSONTokener.syntaxError (JSONTokener.java:450) > W / System.err: at org.json.JSONTokener.nextValue (JSONTokener.java:97)
W / System.err: at org.json.JSONObject. (JSONObject.java:155)
W / System.err: at org.json.JSONObject. (JSONObject.java:172) W / System.err: at JsonObjectRequest.parseNetworkResponse (CustomJsonObjectRequest.java:58)
W / System.err: at com.android.volley.NetworkDispatcher.run (NetworkDispatcher.java:125)
E / Volley: [8220] NetworkDispatcher.run: Unhandled exception
java.lang.NullPointerException
java.lang.NullPointerException at com.android.volley.NetworkDispatcher.run (NetworkDispatcher.java:130)
In PHP I had the same problem at first and solved using the utf8_encoder
function.