I am currently hosting a PHP Facebook app on Heroku, in which I use cURL to obtain data about users from the Graph API.
I am having problems where the data returned contains unicode characters, in that json_decode on the Heroku system isn't outputting the unicode characters correctly. The output on my local system (identical code) is fine.
Looking at the raw JSON returned from Graph, I can see that it contains unicode escapes eg
{"id":"100003517896374","name":"Sky\u00e9 Mont\u00e1na","first_name":"Sky\u00e9","last_name":"Mont\u00e1na","link":"http:\/\/www.facebook.com\/skye.montana.73","username":"skye.montana.73","gender":"female","locale":"en_US"}
On my local system, json_decode converts this to the following object:
stdClass Object ( [id] => 100003517896374 [name] => Skyé Montána [first_name] => Skyé [last_name] => Montána [link] => http://www.facebook.com/skye.montana.73 [username] => skye.montana.73 [gender] => female [locale] => en_US )
On the Heroku system it is converted as follows:
stdClass Object ( [id] => 100003517896374 [name] => Skyé Montána [first_name] => Skyé [last_name] => Montána [link] => http://www.facebook.com/skye.montana.73 [username] => skye.montana.73 [gender] => female [locale] => en_US )
My understanding of json_decode is that it will recognise and correctly interpret unicode. In this case, on Heroku, it appears to be recognising unicode, but not interpreting it correctly.
Is there some PHP setting I need to make to fix this? Is it something to do with magic_quotes perhaps? I've set both servers to have the same magic_quotes option (Off) but it makes no difference.