I use
$link = json_decode(file_get_contents("http://graph.facebook.com/111866602162732"));
the result on that page shows:
"name": "L\u00e9ry, Quebec",
I then want to convert that with the accents.. like this:
$location_name = $link->name;
echo 'NAME ORIGINAL: '.$location_name;
$location_name = preg_replace('/\\\\u([0-9a-fA-F]{4})/', '&#x\1;', $location_name); // convert to UTF8
echo ' NAME after: '.$location_name;
I get the following result:
NAME ORIGINAL: Léry, Quebec NAME after: Léry, Quebec
my preg_replace is correct, so it's the original name that is being transformed by the file_get_contents.