Cocoanetics / DTCoreText

Methods to allow using HTML code with CoreText
BSD 2-Clause "Simplified" License
6.35k stars 1.18k forks source link

"<" disappearing on iOS 16 #1275

Open ouachman opened 8 months ago

ouachman commented 8 months ago

Hello,

Using NSAttributedString initWithHTMLData method with text that contains "< " (note the space after the sign) will make all the text on the right, including "< " go away. This is only happening since iOS 16. It was working fine before. And only happening with "< ".

As a workaround I am reverting to the iOS native (and very slowwww) transformation when the text contains "< ".

I suspect this is considered as a tag and it's looking for the corresponding ending tag. Indeed a string like "a < b > c" will be transformed to "a c". When "ac" will stay unchanged.

Any idea how to fix this?

Thanks, Eric

odrobnik commented 8 months ago

String replace '<' with '& lt;' before parsing?