In a nutshell, french characters are causing trouble when sending string from my android app to php and decoding it using JSON. Here is what I am doing in my android app (Java)
HttpPost httppost = new HttpPost(//my server and filename);
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("payload", jsonObj.toString()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
}....
And here is my php code
$_POST['payload'] = stripslashes($_POST['payload']);
$payload = $_POST['payload'];
error_log(" $payload ", 0);
$payloadObj = json_decode($payload);
error_log(" $payloadObj ", 0);
When english letters are used then everything is perfect, however is perfect but when I accented frensh letters then it does not work. I inserted the above Error logs to see what I get and I noticed that with French letters, payload is showing the french letter as � and the payloadObj is empty so I guess the decode failed.
Pleeease help me out,where is exactly the problem happening (at what stage)? How can I solve it?