Re: C char*'s and NSStrings
Re: C char*'s and NSStrings
- Subject: Re: C char*'s and NSStrings
- From: "M. Uli Kusterer" <email@hidden>
- Date: Mon, 4 Aug 2003 16:36:08 +0200
At 2:29 Uhr -0400 04.08.2003, David Cairns wrote:
would using the C string class (or struct -- whatever) work better
than just using a char pointer?
NSString has the advantage of using UniCode internally, which means
that if one of your users is Japanese, and enters their name in
Kanji, you can still generate a serial code from this. However, since
you're probably assuming MacRoman or Latin-1, or another 8-bit
character format based on ASCII, you could probably just change your
code to extract UTF8 text from the NSString. UTF8 is a variant that
uses 8-bit characters and escape sequences for storing Unicode text
(which can have characters of up to four bytes in length, if you use
UTF32).
So, I guess in this particular case, NSString probably won't work
better than just stashing UTF8 in a C-String. However, do not use
ASCII or a straight C-string, and don't make any assumptions about
the bytes in a UTF8-string, apart from them being in range 0 ... 255.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.