• 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: Finlay Dobbie <email@hidden>
  • Date: Thu, 3 Jan 2002 20:26:03 +0000

On Thursday, January 3, 2002, at 04:51 am, Johnny CN Lee wrote:

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.

Just to take a new approach other than the ones that have been suggested here, you could do something along the lines of this:

// assume myString is something proper
FSRef myRef;
NSURL *myURL = [NSURL fileURLWithPath:myString];
if (!CFURLGetFSRef((CFURLRef)myURL, &myRef)) {
// handle error
}

And to go backwards:

// assume myRef is valid
CFURLRef myURL = CFURLCreateFromFSRef(kCFAllocatorDefault, &myRef);
NSString *myString = (NSString *)CFURLCopyPath(myURL);
CFRelease(myURL);
// remember to release myString

-- Finlay


References: 
 >Unicode filename and FSPathMakeRef (From: Johnny CN Lee <email@hidden>)

  • Prev by Date: Re: Screen Fade Out
  • Next by Date: Re: Movie Files
  • Previous by thread: Re: Unicode filename and FSPathMakeRef
  • Next by thread: Re: Unicode filename and FSPathMakeRef
  • Index(es):
    • Date
    • Thread