fql query character encoding

大兔子大兔子 提交于 2020-01-06 20:01:30

问题


I am executing a FQL query, and if I print the array with the results I get wrong characters.

For example instead of ò I get ò.

my webpage is set to: text/html; charset=ISO-8859-1

I think it's an issue with facebook and not with me.. Have you experienced something similar and did you manage to solve it?


回答1:


The results from Facebook are in UTF-8 encoding.

ò character is c3b2 in UTF-8 (hex) 0xC3 - Ã 0xB2 - ²

To convert the results to ISO-8859-1 from UTF-8 in PHP you may use utf8_decode function:

$source = chr(0xc3).chr(0xb2);
$result = utf8_decode($source); // -> 0xF2 (ò in ISO-8859-1)


来源:https://stackoverflow.com/questions/9656029/fql-query-character-encoding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!