Re: ASL & Unicode in Xcode's Console
Re: ASL & Unicode in Xcode's Console
- Subject: Re: ASL & Unicode in Xcode's Console
- From: Jason Coco <email@hidden>
- Date: Wed, 29 Oct 2008 00:14:16 -0400
On Oct 28, 2008, at 16:53 , Sean McBride wrote:
On 10/28/08 4:03 PM, Jason Coco said:
Also, you should not be using non-ascii characters in string
literals :) hopefully you're just doing this to demonstrate the
issue.
You should
be doing something like this:
char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 };
NSLog(@"%@", [NSString stringWithCString:a
encoding:NSUTF8StringEncoding]);
That is no longer necessary in 10.5 / Xcode 3. You can use Unicode in
string literals in Objective-C.
Why do you say this? I thought that I may have missed something, but
looking
back through all the documentation, all the warnings about only
including 7-bit ASCII
characters in string literals still exist... even in the most recent
updated documentation.
The Objective-C 2.0 language guide says it explicitly. The String
Programming Guide
for Cocoa states it explicitly. The CFString reference guide even
states it explicitly
when using the CFSTR(...) macro. GCC has always maintained that while
it may
work sometimes for standard C string literals in properly encoded
source files, the
results of anything other than 7-bit string literals is still undefined.
Given that all of these documents have very recent updates... what
makes you say
that one can use Unicode in string literals in Objective-C? I still
assert that there's
really no reason to, and until the functionality is generally
available and in wide
use, it's much safer to never assume that a string literal can be
anything but
7-bit and to use resource files like string files to hold data that
will be displayed
to the user.Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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