• 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: Why is NSString->FSRef so hard?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is NSString->FSRef so hard?


  • Subject: Re: Why is NSString->FSRef so hard?
  • From: Erg Consultant <email@hidden>
  • Date: Mon, 27 Apr 2009 22:13:37 -0700 (PDT)

I abandoned the idea of using the temp file and now I assemble the path
to the file I want on the fly using the main bundle and an Info.plist
file which contains the executable file name - I am still having the
same problem - without the STL string, temp file, or reading any file
at all. So the STL string is no longer an issue - but the problem is.

Apple's doc's specifically say to stay away from using the "CString" routines which require encodings. So now the encoding issue goes away. The problem is LSOpenApplication() does not like the FSRef I pass it which gets created from the path NSString->CFURL->FSRef.

Erg


________________________________
From: Michael Ash <email@hidden>
To: cocoa-dev <email@hidden>
Sent: Monday, April 27, 2009 9:51:14 PM
Subject: Re: Why is NSString->FSRef so hard?

On Tue, Apr 28, 2009 at 12:26 AM, Erg Consultant
<email@hidden> wrote:
> One other thing I should mention - the mangled char in question is the tm symbol (option-2). In its string form, the debugger shows it as the tm char.
>
> But when I convert the string to an NSURL using fileURLWithPath, and then do a CFShow, the tm is converted to *three* hex chars:
>
> ™
>
> Are NSURL and CFURL not toll-free bridged?

Read this:

http://www.joelonsoftware.com/articles/Unicode.html

And then this:

http://en.wikipedia.org/wiki/UTF-8

And this:

http://en.wikipedia.org/wiki/UTF-16

Then, suitably enlightened, come back and fix up your code to work
with your new knowledge.

One other piece of knowledge: if you're converting your std::string to
an NSString by writing it to a file, you're doing it wrong. Very,
very, very wrong. All you should have to do is [NSString
stringWithCString:stl_string.c_str() encoding:...] with the
appropriate encoding substituted at the end. If you do not know the
appropriate encoding, then you must find out. If the encoding is not
UTF-8, then I strongly encourage you to make whatever changes are
necessary so that it *is* UTF-8, as UTF-8 is the only sensible 8-bit
encoding to use these days unless you're communicating with legacy
systems.

Mike
_______________________________________________

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




_______________________________________________

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: Why is NSString->FSRef so hard?
      • From: Clark Cox <email@hidden>
    • Re: Why is NSString->FSRef so hard?
      • From: Michael Ash <email@hidden>
References: 
 >Why is NSString->FSRef so hard? (From: Erg Consultant <email@hidden>)
 >Re: Why is NSString->FSRef so hard? (From: "Sean McBride" <email@hidden>)
 >Re: Why is NSString->FSRef so hard? (From: Erg Consultant <email@hidden>)
 >Re: Why is NSString->FSRef so hard? (From: Michael Ash <email@hidden>)

  • Prev by Date: Re: Why is NSString->FSRef so hard?
  • Next by Date: Re: Why is NSString->FSRef so hard?
  • Previous by thread: Re: Why is NSString->FSRef so hard?
  • Next by thread: Re: Why is NSString->FSRef so hard?
  • Index(es):
    • Date
    • Thread