Re: Unicode filename and FSPathMakeRef
Re: Unicode filename and FSPathMakeRef
- Subject: Re: Unicode filename and FSPathMakeRef
- From: Norbert Heger <email@hidden>
- Date: Thu, 03 Jan 2002 17:57:03 +0100
Johnny CN Lee <email@hidden> asked:
>
I use FSPathMakeRef to convert a NSString filename to FSRef. How
>
should I convert a unicode filename (Chinese or Japanese) to a
>
(const UInt8 *) buffer for FSPathMakeRef to use properly? I've
>
tried NSString's CString and UTF8String, but failed.
Greg Titus <email@hidden> answered:
>
The NSString -fileSystemRepresentation method should do the trick.
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.
However, the fileSystemRepresentation method indeed sounds to be better
suited for this task. But this raises another question: How are we supposed
to convert such a fileSystemRepresentation back to an NSString (e.g. when
using FSRefMakePath)? Currently I'm using [NSString stringWithUTF8String:]
and it seems to work fine.
Best Regards, Norbert
_____________________________________________
Norbert Heger, Objective Development
http://www.obdev.at/