• 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: Unicode filename and FSPathMakeRef
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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/


  • Follow-Ups:
    • Re: Unicode filename and FSPathMakeRef
      • From: Douglas Davidson <email@hidden>
References: 
 >Re: Unicode filename and FSPathMakeRef (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: Apple's excellent documentation on class clusters
  • Next by Date: Cocoa Developer in Training: Language Question (ObjC or Java)?
  • Previous by thread: Re: Unicode filename and FSPathMakeRef
  • Next by thread: Re: Unicode filename and FSPathMakeRef
  • Index(es):
    • Date
    • Thread