• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: characters in cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: characters in cocoa
      • From: "Clark Cox" <email@hidden>
    • Re: characters in cocoa
      • From: "Gerriet M. Denkmann" <email@hidden>
    • Re: characters in cocoa
      • From: "Lukhnos D. Liu" <email@hidden>
References: 
 >Re: characters in cocoa (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: RS: Reply about NSObject members class, isMemberOfClass, isKindOfClass
  • Next by Date: Capturing the Managed Object Context in a non-document application
  • Previous by thread: Re: characters in cocoa
  • Next by thread: Re: characters in cocoa
  • Index(es):
    • Date
    • Thread