Re: 8-bit chars in @""
Re: 8-bit chars in @""
- Subject: Re: 8-bit chars in @""
- From: Ali Ozer <email@hidden>
- Date: Mon, 25 Mar 2002 11:42:32 -0800
>
[NSString stringWithCharacters:(unichar*)"\x20\x22" length:1]
>
>
That's my favorite as being easiest to read when you know the hex
>
unicode
>
values, and as being self-contained. The cast is just to stave off the
>
compiler warning; it isn't really necessary.
Ah, but this is not endian-safe! (This might be academic, but it's
always a good idea to write endian-independent code.) If you're going
to be taking this approach, the UTF-8 version is safer:
>
[NSString stringWithUTF8String: "\xE2\x80\xA2"]
Ali
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.