Re: (newbie question) Putting special characters in NSStrings
Re: (newbie question) Putting special characters in NSStrings
- Subject: Re: (newbie question) Putting special characters in NSStrings
- From: Clark Cox <email@hidden>
- Date: Mon, 21 Mar 2005 10:21:33 -0500
On Mon, 21 Mar 2005 10:11:24 -0500, Sean McBride
<email@hidden> wrote:
> On 2005-03-18 21:39, Nicko van Someren said:
>
> >On the other hand [NSArray arrayWithObjects: @"£", @"±", @"§", @"€",
> >nil] has some decidedly odd behaviour because X-code UTF-8 encodes the
> >top-bit set characters (in fact the Euro symbol is not even an 8 bit
> >character). In order to handle these you can use [NSString
> >stringWithUTF8String: "±§£€"], which will work as expected as long as
> >you select Format->File Encoding->Unicode (UTF-8), which is certainly
> >the default in the UK and may well be elsewhere.
>
> I'm not so sure. It has often been said, here and elsewhere, that non-
> ASCII characters cannot be used in source files,
To be more specific: non-ASCII characters cannot be used inside @"foo"
or CFSTR("foo") constructs.
> and that you'd need to
> load such a string from a .strings or .plist file. I'm not sure why this
> is the case, its so 1990s. :)
>
> It is also often said that Obj-C is a strict superset of C, but C (C99
> anyway) does allow non-ASCII variable names, comments, strings, etc. For
> example,
>
> int \u30AD\u30B3\u30DE\u30A6 = 420;
>
> is valid C, so should be valid Obj-C. It compiles in CodeWarrior 9.4
> though I just tried and gcc 3.3 does not accept it.
>
> So is it invalid Obj-C to use non-ASCII strings in source, or is it
> disallowed just because gcc is not C-compliant, or is Obj-C not C99-
> based, or what? I do wish there was an ISO Obj-C standard. :)
Obj-C is based on whatever C your compiler supports, and currently,
GCC does not support the Universal Character Name feature of C99.
--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden