如何通过 facebook graph api 将变音符号(或 esp 瑞典语)符号发布到用户状态?
编辑:对于互联网: utf8_encode 做到了。在撰写本文时,我不记得我是否执行了 urlencode(utf8_encode($msg)) 或者 utf8_encode($msg) 是否足够。但是需要 utf8_encode。 GL HF!
原始问题:
当消息(可以这么说)来自正常 ascii 范围的内容时,我已成功通过图形 API 将状态消息发布到用户的状态。
像这样(PHP):
$msg = "Hello dudes!";
$curlobject = new cURL();
$postparams = "access_token=" . SSN_code() . "&message=" . urlencode($msg);
$r = $curlobject->post("https://graph.facebook.com/me/feed",$postparams);
->好的!状态已根据需要更新。
但是,当我在消息中使用 å、ä 或 ö 时(我希望能够这样做,因为有些用户是瑞典人),状态消息会在变音符号所在的三角形中显示一个问号。因此,就像,
$msg = "Hello kåldolmar!";
会导致“Hello k�ldolmar!”的状态。
有人知道如何对符号进行编码或用更多信息补充图形请求以使消息正确显示吗?
EDIT: For the internet: utf8_encode did the trick. At the time of writing this I can't remember if I did urlencode(utf8_encode($msg)) or if utf8_encode($msg) sufficed. However the utf8_encode was needed. Gl hf!
Original question:
I have succeeded in posting status messages to users' statuses through the graph API when the message is (so to speak) content from the normal ascii range.
Like this (PHP):
$msg = "Hello dudes!";
$curlobject = new cURL();
$postparams = "access_token=" . SSN_code() . "&message=" . urlencode($msg);
$r = $curlobject->post("https://graph.facebook.com/me/feed",$postparams);
-> OK! Status updated as wanted.
However, when I use å, ä or ö in my messages (which I'd like to be able to do, since some users will be Swedish, the status messages display a question mark in a triangle where the diacritic signs are. So, like,
$msg = "Hello kåldolmar!";
would result in a status of "Hello k�ldolmar!".
Anyone knows how to encode the signs or to complement the graph request with more info to make the messag edisplay correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 htmlspecialchars
Use htmlspecialchars