I have an iPhone application in which I am sending text in an UITextview
to a server through a web service. and in the next page I am displaying the list of comments from the server through the web service. Everything is working fine except when I insert emoji/emoticons in the UITextview
.
The next page displays square boxes instead of some emoji character (not all).
I have noticed that:
Working: I have inserted one emoji character in
UITextview
from an emoji keyboard and printed its code in log, \u2601, and submitted this text to the server. In the next page I got the same unicode \u2601 and it's working fine. It shows me the emoji icon.Not Working: Now I have inserted another emoji character in the
UITextview
from the emoji keyboard and printed its code in log, \ud83d\udc16, and submitted this text to the server. In the next page I got a unicode codepoint which is different from what I sent: \uf416. iPhone doesn't recognize this unicode so it gives me a square box.
So what is the problem here? It's not working only when the emoji character has a pair of unicode codepoints.
The database in which the comment is stored is MySQL version 5.5.
Why does the emoji character code pair change when retrieved from the server? How to decode the retrieved Unicode into its original form so iPhone can recognize it?