Facebook SDK 的字符集
我需要使用 Facebook SDK,因此在一些帮助下,我编写了可以查找人员信息的脚本。但是如果他/她的名字中有变音符号,就会出现格式错误,我尝试在SDK文件中设置字符集,但没有帮助。
例如,如果名字是 René Beneš,则它将是 RenĂ© Beneš。
你能帮我吗?
谢谢
I needed to work with Facebook SDK, so with some help, I wrote script that can find informations about person. But if there is diacritic in his/her name, it will be malformed, I tried to set charset in SDK files, but it doesn't help.
For example, if the name is René Beneš, it will be RenĂ© Beneš.
Can you help me please?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可以在角色层面上描述这里发生的事情——我希望它能帮助你更接近解决方案。您显然以 UTF-8 编码获得数据,但您的软件将其解释为 ISO-8859-2(ISO Latin 2,“东欧”)编码。例如,字母“é”(U+00E9)在UTF-8中是两个字节0xC3 0xA9。如果根据 ISO-8859-2 错误地解释字节,则 0xC3 变为 Ă,0xA9 变为 ©。
因此,您应该尝试让您的软件读取并处理 UTF-8 格式的数据,或者将其从 UTF-8 转码为您使用的编码。
I can describe, at the character level, what is going on here – I hope it helps you closer to a solution. You apparently get the data in UTF-8 encoding, but your software interprets it as ISO-8859-2 (ISO Latin 2, “East European”) encoding. For example, letter “é” (U+00E9) is two bytes 0xC3 0xA9 in UTF-8. If the bytes are incorrectly interpreted according to ISO-8859-2, 0xC3 becomes Ă and 0xA9 becomes ©.
So you should try to make your software read and process the data in UTF-8 or to transcode it from UTF-8 to the encoding you use.
我确信 utf8_decode 和/或 utf8_encode 非常适合您。
I'm sure utf8_decode and/or utf8_encode will work great for you.
第一个示例 - PHP
我建议您使用名为 str_replace() 的 PHP 函数:
您可以在 PHP 官方网站 - str_replace()。
此外,有关特殊字符的更多信息和 HTML 代码,请访问 HTML 中的特殊字符 。
第二个示例 - HTML
尝试
在
部分之间替换:。
1st Example - PHP
I suggest you to use PHP function called str_replace():
You can find more about that function on official PHP website - str_replace().
Furthermore, more informations and HTML codes about special characters are available on Special Characters in HTML.
2nd Example - HTML
Try to replace:
between your
<head></head>
section.