将编码的字符串转换回正常

时间:2011-01-01 11:29:36

标签: php facebook unicode facebook-graph-api

  

可能重复:
  Unicode characters from JSON.stringify to real unicode characters

似乎facebook以这种格式保存unicode字符串:

  

\ u10d \ u10d \ u10d \ u10d \ u10d \ u10d \ u10d0 \ u10e1 \ u10e3 \ u10ee \ u10d8 \ u10dc \ u10d4 \ u10d1 \ u10d8 \ u10e1 \ u10db \ u10d8 \ u10d4 \ u10e0 \ u10d9 \ u10d8 \ u10d7 \ u10ee \ u10d5 \ u10d0 \ u10d6 \ u10d4!

如何将其转换回可读字符串?

1 个答案:

答案 0 :(得分:4)

Facebook Graph API返回JSON,用于在PHP中理解这一点的工具是json_decode()

$json = file_get_contents('https://graph.facebook.com/Answersge');
$data = json_decode($json, true);
echo $data['company_overview']; // Outputs: იპოვეთ პასუხი ნებისმიერ კითხვაზე!