• 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: AM/PM letter UNICODE issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AM/PM letter UNICODE issues


  • Subject: Re: AM/PM letter UNICODE issues
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Tue, 19 Oct 2010 11:04:24 +0700

On 19 Oct 2010, at 00:54, Alex Kac <email@hidden> wrote:

> 	NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
> 	NSString* am = [[[formatter AMSymbol] substringToIndex:1] lowercaseString];


Please note that substringToIndex does only sometimes return a valid string.

I just tried:

NSString *a = @"𝍢";	//	COUNTING ROD UNIT DIGIT THREE
NSLog(@"%s a \"%@\"",__FUNCTION__, a);	//	ok

NSString *badString = [ a substringToIndex: 1 ];
NSLog(@"%s a \"%@\" badString \"%@\"",__FUNCTION__, a, badString);	// ← this never shows
// because "badString" is not a valid string at all (I would have expected some log message though).

NSRange aRange = [ a rangeOfComposedCharacterSequenceAtIndex: 0 ];
NSString *goodString = [ a substringWithRange: aRange ];
NSLog(@"%s a \"%@\" goodString \"%@\"",__FUNCTION__, a, goodString);
// this works ok and contains the first "character" in of string "a".

I admit that it is rather unlikely that this will be a problem with normal Korean text (but I know nothing about Korean scripts).


Kind regards,

Gerriet.

_______________________________________________

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

  • Prev by Date: Re: Unarchiving cells out of order.
  • Next by Date: Re: Problem using dictionary
  • Previous by thread: Re: AM/PM letter UNICODE issues
  • Next by thread: NSOperation completionBlock not executed
  • Index(es):
    • Date
    • Thread