Re: Why is NSString->FSRef so hard?
Re: Why is NSString->FSRef so hard?
- Subject: Re: Why is NSString->FSRef so hard?
- From: Michael Ash <email@hidden>
- Date: Tue, 28 Apr 2009 00:51:14 -0400
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