why does cyrillic letters in NSMutableAttributedString give NSRange length of 2 for each character in ios 15 and only 1 for each character in ios 17?

Generated on 8/5/2024

1 search

The difference in the NSRange length for Cyrillic letters between iOS 15 and iOS 17 is likely due to changes in the text rendering and handling APIs introduced in the newer versions of iOS.

In iOS 15, the text rendering system might have treated certain characters, especially those from non-Latin scripts like Cyrillic, as composed characters, resulting in a length of 2 for each character. This could be due to the way the text engine handled Unicode characters and their combining marks.

In iOS 17, improvements and updates to the text rendering system, such as those mentioned in the session Build multilingual-ready apps, have likely optimized the handling of Unicode characters, ensuring that each character, including Cyrillic letters, is treated as a single unit, resulting in a length of 1.

These updates are part of Apple's ongoing efforts to improve text handling and rendering across different languages and scripts, ensuring better accuracy and performance in multilingual applications.