How to post diacritic (or esp swedish) signs to user status through facebook graph api?
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?
Use htmlspecialchars
$msg = htmlspecialchars("Hello kåldolmar!");
output will be Hello kåldolmar!
精彩评论