how many user-perceived character(s) when it comes to coloured Emoji?

Hi,


In swift2 standard library playground, it says that


> Each Character value in a string represents any user-perceived Unicode character, regardless of the character's length or representation in memory


But when I put a colored emoji, the `visualize()` method shows 2 characters for the colored emoji, isn't that should be one??


Here is the screen capture:



I've already reported that apple bug report and openRadar(21434789), but I want to see if anybody already had the answer.

Accepted Reply

Chris Lattner confirmed this as a bug a while ago: https://devforums.apple.com/message/1126558#1126558

Replies

Chris Lattner confirmed this as a bug a while ago: https://devforums.apple.com/message/1126558#1126558

The problem is that Apple jumped the gun a bit on the emoji race modifiers. Those are part of Unicode 8.0 so the existing libraries using Unicode 7.0 tables and algorithms don't know what to do with those codepoints. Apple updated their fonts and UI to handle the race modifiers, but they left their libraries at Unicode 7.0 because 8.0 hadn't actually been released yet.


Now that the final Unicode 8.0 spec is out (it was released yesterday) Apple can update their Unicode implementation to match, which will fix that problem. Hopefully we'll see the new Unicode version show up in an upcoming seed.

Apple must have updated their website and I can no longer go to this link. Do you know how to do this method for Swift 3?

Apple must have updated their website and I can no longer go to this link.

That is a link to the old DevForums, which still works in general. It does, however, require more privileges than the new DevForums, which probably explains why you can’t access it.

Reading the linked-to post, it references a bug report (r. 20511834) which is still open )-:

Do you know how to do this method for Swift 3?

Given that there’s been lots of change in this space over the years, I think it’d be helpful if you posted details about the specific problem you’re having.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"