Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
- Subject: Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
- From: Jens Alfke <email@hidden>
- Date: Sat, 05 May 2012 16:53:00 -0700
On May 5, 2012, at 3:18 PM, Quincey Morris wrote:
> "ß" within a string probably compares equal to "ss" at the corresponding position, independently of the language. (This makes sense, I think.) Therefore "laßt" > "lasso" always.
I don’t know about this specific case, but these rules definitely vary by locale — there are cases where two languages use the same letter but disagree about how it sorts. (For example, the rules for sorting “LL” in Spanish are not the same as in English.)
> However, when the second word doesn't have "ss" in corresponding position, then the order is determined by pure character collating sequence for the language. In your case (which I'm guessing is English), 'ß' < 's'. In Markus's case (which I'm guessing is German), 'ß' > 's'.
I think this must be a bug in the collation implementation for the German locale. To be useful for sorting and searching, a comparison function *has* to obey transitivity, and this example is breaking it.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden