• 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: Finder Info
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder Info


  • Subject: Re: Finder Info
  • From: David Duncan <email@hidden>
  • Date: Mon, 27 Aug 2012 10:43:16 -0700

On Aug 27, 2012, at 9:50 AM, Sean McBride <email@hidden> wrote:

> On Sat, 25 Aug 2012 17:58:39 +0200, Uli Kusterer said:
>
>>>>     const UInt8 *cpath = (const UInt8 *)[path
>> cStringUsingEncoding:NSUTF8StringEncoding];
>>>
>>> -UTF8String is shorter.
>>
>> Both of these are wrong, though. You should *always* use -
>> fileSystemRepresentation when you need a C-string representation of a
>> path. Otherwise you might get decomposed characters that don't match the
>> actual way the characters are stored on disk, and will create a second
>> file with an almost-indistinguishable name.
>
> Could you provide an example filename where UTF8String and fileSystemRepresentation give something different?  I'd like to run it through QA...


The primary difference is that the fileSystemRepresentation uses a particular form of unicode composition (if I recall correctly, Decomposed form D). As such if you had a UTF-8 encoded Ä (Latin Capital Letter A with Diaresis) vs A¨ (Latin Capital Letter A with Combining Diaeresis) then you could get different results (and I believe the former would be an invalid file name).

Note: this is primarily from memory so this exact example may or may not fail, but should give you a framework for finding ones that do.
--
David Duncan


_______________________________________________

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: Finder Info
      • From: Ken Thomases <email@hidden>
References: 
 >Re: Finder Info (From: Greg Guerin <email@hidden>)
 >Re: Finder Info (From: koko <email@hidden>)
 >Re: Finder Info (From: Jens Alfke <email@hidden>)
 >Re: Finder Info (From: Uli Kusterer <email@hidden>)
 >Re: Finder Info (From: Sean McBride <email@hidden>)

  • Prev by Date: Re: Distributed Objects
  • Next by Date: Re: Finder Info
  • Previous by thread: Re: Finder Info
  • Next by thread: Re: Finder Info
  • Index(es):
    • Date
    • Thread