Re: Unicode filename and FSPathMakeRef
Re: Unicode filename and FSPathMakeRef
- Subject: Re: Unicode filename and FSPathMakeRef
- From: Douglas Davidson <email@hidden>
- Date: Thu, 3 Jan 2002 09:29:34 -0800
On Thursday, January 3, 2002, at 08:57 AM, Norbert Heger wrote:
Till now I used [path UTF8String] for this purpose without any
problems. I
just ran a little test with thousands of different filepaths, comparing
the
values returned from -UTF8String and -fileSystemRepresentation, and I
didn't
find a single case of different return values.
Nevertheless, there is a difference, both conceptual and practical.
First, -fileSystemRepresentation should return a string in the encoding
appropriate for filesystems on the current platform, whatever that may
be, instead of a hard-coded UTF-8. The encoding for Mac OS X is
unlikely to change, but fileSystemRepresentation is still the right
thing to use just from this standpoint. Second, the appropriate
representation for filesystem paths on Mac OS X is actually specified as
(I believe) canonically decomposed UTF-8, which is what
fileSystemRepresentation returns, as opposed to simply converting the
Unicode string as given into UTF-8. You might well test with thousands
of different paths without encountering a case where these differ, but
it is possible.
Douglas Davidson