Soft hyphen is not working properly in iOS 15

label.text = "Very\u{00AD}VeryVeryVeryVeryVeryLongWordWithASoftHyphenTo"

Replies

Yeah seems like bug in iOS 15, I am suffering from that too with hyphenation in UILabel and UITextView.

Our app is multi-language and can have few different languages on one screen, but UILabel's and UITextView's auto-hyphenation works only using systems language(first item in preferredLanguages), thus we are placing unicode soft-hyphen characters U+00AD ourself's depending on the dominant language of string itself.

Before iOS 15 we had correct hyphenation, but on new iOS it seems that even if "usesDefaultHyphenation" is off, when string is containing this \u{00AD} unicode soft hyphen symbol that auto-hyphenation activates using systems language rules and adding additional hyphens to the string (and this hyphens wrong if system language English but the word is German).

I've added VC file, there are UILabel and UITextView, with string containing customly placed hyphens \u{00AD}. If you will run it on iOS 14 you will see correct hyphenation of "Publikumslieblinge" word, but if you will run it on iOS 15 the hyphenation will be wrong.

Correct hyphenation in German will be: "Pu-bli-***-lieb-lin-ge".

If iOS will use English hyphenation rules on this German word hyphenation will be: "Pub–likum–slieblinge".

And in our case it mixes both: "Pu-b–li-***–s-lieb-lin-ge".

Placed TSI ticket, this bug seems breaking any chance to have correct hyphenation for texts with language different from systems language.

Add a Comment

@thekingofsofa Did you receive some feedback regarding issue with hyphenation? If yes, could you share information about it?

I have the exact same problem, I made a Technical Support Incident report to Apple, I hope it will get some answers.

I got a response from the support team, they wanted me to make a Feedback Assistant issue that they promised to prioritise. https://feedbackassistant.apple.com/feedback/9970709

@andrewUp Yes, sorry for late response:

Before iOS 15, we strictly followed soft hyphen, while in iOS 15 we now only consider those as hyphenation opportunities.

That is the design, and there are no plans to change it.  The app should be able to use languageIdentifier attribute to influence the hyphenation with the attributed string so that it should follow German hyphenation even when system language is English.

https://developer.apple.com/documentation/foundation/attributescopes/foundationattributes/3802173-languageidentifier

So basically now we should use languageIdentifier attribute, lesser opportunities for our own custom hyphenation rules (like ugly, one side short, hyphenation break), but works grammatically correctly.