Question

We have implemented an iphone app which uses the facebook chat, partly over xmpp and partly over the facebook graph api.

Everything is fine, until it comes to emoticons. When we enter the emoticon on the iPhone, we get the correct emoticon on our display.

But the message, we get from facebook is some other escape sequence as we sendt to facebook via xmpp.

Heres an example: We send the following xml via xmpp:

<message type="chat" to="-someFacebookID@chat.facebook.com"><body>😷</body></message>

When we recall that message from facebook we get the follwing:

{
"author_id" = someID;
body = "\Uf637";
"created_time" = 1351607849;
"message_id" = "someID_41";
"thread_id" = someID;
}

Here is our FQL-Statement for the messages:

@"SELECT message_id, author_id, thread_id, created_time, body FROM message WHERE thread_id = %@"

But why does facebook convert the emoticon, which displays correctly in the facebook-chat on the website? Any ideas on this problem?

Regards, Daniel

Was it helpful?

Solution

The returned text (such as "\Uf637" in your sample) is the unicode representation of the emoticon. Facebook's database does not store emoticons in their full form, they are converted to unicode, and are converted back to their emoticon form when displayed on Facebook's apps. You'll probably have to do the same thing in your own app when using the Chat API (for all unicode emoticon-like strings found, convert it to the actual emoticon). Here is a full list of unicode codes with their matching emoticon symbols: http://www.unicode.org/charts/PDF/U1F600.pdf

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top