Re: characters in cocoa
Re: characters in cocoa
- Subject: Re: characters in cocoa
- From: Uli Kusterer <email@hidden>
- Date: Mon, 10 Sep 2007 15:36:34 +0200
On 10.09.2007, at 13:38, Gerriet M. Denkmann wrote:
One might add that -[NSString length], which the documentation says
"Returns the number of Unicode characters in the receiver." does
nothing like this, but returns the number of shorts used with
NSUnicodeStringEncoding (aka Utf-16).
For example: [[NSString stringWithUTF8String: "𐐀" ] length] = 2
(if someone cannot handle Unicode (like the mail digest software at
Apple) : this is a DESERET CAPITAL LETTER LONG I) - although the
string clearly contains one character.
And one should also note that "characterAtIndex:" does not do what
the name indicates, but returns the short at the index in utf-16.
getCharacters: "Returns by reference the characters from the
receiver." - the documentation really should mention in which
encoding these characters will be copied.
Maybe the documentation could be slightly improved: it is confusing
if it says "character" when it means "unsigned short int in a
specific (but unspecified) encoding".
Well, it *is* a character: It is the UTF16 character that would be
at the specified index in the normalized form, I guess...?
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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