While retrieving some data from an online db, I can't figure our why some characters get "misinterpreted".
I send the data from the server through a PHP app, like so:
header('Content-Type: application/json');
// tried also header('Content-Type: application/javascript');
// tried also header('Content-Type: application/json; charset=utf-8');
echo json_encode($object);
If I test the message, the JSON encoded string correctly contains the following string \u00ec
, which represents the letter ì
.
However, in the client, when I check the unparsed string, I see the following string instead: \u00c3\u00ac
, which represent, respectively: Ã
and ¬
(this happens with all special characters like èéàòùü etc.).
As a consequence, when i call JSON.parse() on the response, I see the wrong characters.
Any idea of what I'm doing wrong?