Swift 1.2 on Mac OS X 10.10.3 reports the wrong length for new emoji
| Originator: | jlieske | ||
| Number: | rdar://20511834 | Date Originated: | 11-Apr-2015 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 6.3 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: Mac OS X 10.10.3 includes new diversity emoji. These emoji are encoded as two Unicode code points: a base emoji and a modifier codepoint that changes the skin color of the base emoji. The resulting emoji has a single grapheme representation — they appear as one indivisible character to user. However, Swift 1.2 considers these new emoji to be two characters instead of a single character in size. This is inconsistent with how Swift counts other Unicode modifier codepoints. Steps to Reproduce: 1. Use Xcode 6.3 to create a Swift playground for OS X. 2. Enter the following Swift code. es1 is a traditional emoji, and es2 is a diversity emoji. let es1 = "👌" count(es1) let ec1 = Character(es1) let es2 = "👌🏽" count(es2) let ec2 = Character(es2) Expected Results: * The output of both calls to count() should be 1. * The output of both Character() constructors should be valid. Actual Results: * count(es1) = 1, but count(es2) = 2 * Character(es2) fails to execute (the playground stops showing output) Version: Xcode 6.3 (6D570) OS X 10.10.3 (14D131)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!