Reputation: 6510
I'm writing a Twitter app for Mac OS X. I want to show emoji (people sent them on their iOS devices) in NSTextView. Is this possible on the Mac? If so, how can I achieve this?
Thank you in advance. Any help would be appreciated.
Kai
Upvotes: 0
Views: 1806
Reputation: 4515
Note that iOS and Mac OS X Lion use different unicode code points to represent the same emoji character.
The iOS unicode values are documented here: http://pukupi.com/post/1964/ while the Mac OS X Lion ones are documented here: http://www.unicode.org/~scherer/emoji4unicode/snapshot/emojidata.pdf (actually both are documented in that .pdf. OS X 10.7 Lion uses the proposed Unicode standard encoding, while iOS 5 uses the SoftBank column.)
For example, a simple smiley face is i.e. \xe415 on iOS but it is 😄 \x1f604 on Mac OS. You can verify this by looking at this page on both operating systems.
Upvotes: 2
Reputation: 61238
You should be able to do this by searching the string for all occurrences of emoji and replacing them with instances of a custom NSTextAttachment, which draws the appropriate icon inline.
Upvotes: 1