Facebook Chat Api and Emoticons

We have implemented an iphone application that uses facebook chat, partly on top of xmpp and partly on top of the facebook api chart.

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 another escape sequence as we send to facebook via xmpp.

Here is an example: We send the following xml via xmpp:

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

When we recall this post from facebook, we get the following:

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

Here is our FQL-Statement for messages:

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

But why does facebook convert the emoticon that displays correctly in facebook chat on a website? Any ideas on this issue?

Regards, Daniel

+4
source share
1 answer

The returned text (for example, "\ Uf637" in your example) is a unicode representation of the emoticon. Emoticons are not stored in the Facebook database in full form; they are converted to unicode and converted back to their emoticon when displayed in Facebook applications. You will probably have to do the same in your application when using the chat API (for all Unicode-style strings converted to a real emoticon). Below is a complete list of Unicode codes with corresponding emoticon characters: http://www.unicode.org/charts/PDF/U1F600.pdf

+3
source

Source: https://habr.com/ru/post/1443007/


All Articles