3 ms·
> Swift is Unicode correct so the equality operator (“==”) checks > for Unicode canonical equivalence. I think this is what this implies, but does Swift do
by steveklabnik 11y ago
> Swift is Unicode correct so the equality operator (“==”) checks
> for Unicode canonical equivalence.
I think this is what this implies, but does Swift do grapheme canonicalization/normalization here? And which one? It might be worth adding the "Noël problem" here.
- pkaler 11y agoYes, I believe so. From here: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html https://developer.apple.com/library/ios/documentation/Swift/... "Every instance of Swift’s Character type represents a single extended grapheme cluster. An extended grapheme cluster is a sequence of one or more Unicode scalars that (when combined) produce a single human-readable character." And then later: "For example, LATIN SMALL LETTER E WITH ACUTE (U+00E9) is canonically equivalent to LATIN SMALL LETTER E (U+0065) followed by COMBINING ACUTE ACCENT (U+0301). Both of these extended grapheme clusters are valid ways to represent the character é, and so they are considered to be canonically equivalent"
- steveklabnik 11y agoNice, thank you for the reference.