Re: encoding of file names
Re: encoding of file names
- Subject: Re: encoding of file names
- From: Ken Thomases <email@hidden>
- Date: Tue, 24 May 2011 19:33:46 -0500
On May 24, 2011, at 8:58 AM, John Joyce wrote:
> Sorry, this is a bit of a tangent on the topic...
> When you say "canonical form" here, is that the same as "decomposed" form?
I meant Apple's file-system-specific canonical form, which is a variant of Normalized Form D, which is decomposed.
> Also, do you know offhand any functions to determine if things are decomposed or not?
No. You would have to normalize to a specific form and then compare the pre-normalized to the post-normalized string using a literal compare to detect whether the original was already in the desired form.
> Is there ever a situation where a string might be mixed; made up of composed and decomposed characters?
Yes. You always have to be prepared for that. They're perfectly legal. Also, not all characters with accents or other diacritical marks are decomposable, so they're always composed, so to speak.
> I am sure this becomes more difficult with Arabic, Hebrew and Thai and other writing systems that have highly composed forms. (not sure if that's the right term)
Not really. You always have to be prepared for all contingencies, no matter what. However, usually you shouldn't much care. You just need to be aware of the semantics of the operations you're performing so you can pick the right one -- i.e. isEqual: and isEqualToString: perform literal comparision, while -compare: does not, and the -compare:options:... methods let you choose that as well as case-sensitivity, diacritic-sensitivity, and width-sensitivity. (Of course, there are also convenience methods like -caseInsensitiveCompare:.)
In many cases, you just want to use -localizedStandardCompare:.
Regards,
Ken
_______________________________________________
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