• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: encoding of file names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: encoding of file names
      • From: Quincey Morris <email@hidden>
References: 
 >encoding of file names (From: Chris Idou <email@hidden>)
 >Re: encoding of file names (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Restoring an NSPrintInfo doesn't restore enough
  • Next by Date: -[drawInRect:withFont:] in Image Context?
  • Previous by thread: Re: encoding of file names
  • Next by thread: Re: encoding of file names
  • Index(es):
    • Date
    • Thread