Re: Why is NSString->FSRef so hard?
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