objective c - creating NSCharacterSet with Unicode SMP entries & testing membership -- is this a bug? -


given code:

nsstring *a    = @"a"; nsstring *clef = @"𝄞"; utf32char utf32char = 0x1d11e;  // 𝄞  nscharacterset *cs1 = [nscharacterset charactersetwithcharactersinstring:@"𝄞"]; nscharacterset *cs2 = [nscharacterset charactersetwithcharactersinstring:@"𝄞a"]; nscharacterset *cs3 = [nscharacterset charactersetwithcharactersinstring:@"a𝄞"]; nsmutablecharacterset *mcs1 = [nsmutablecharacterset charactersetwithcharactersinstring:@""]; nsmutablecharacterset *mcs2 = [nsmutablecharacterset charactersetwithcharactersinstring:@""];  [mcs1 addcharactersinstring:clef]; [mcs1 addcharactersinstring:a];  [mcs2 addcharactersinstring:a]; [mcs2 addcharactersinstring:clef];  nslog(@"cs1 - %@",  [cs1  longcharacterismember:utf32char] ? @"yes" : @"no"); nslog(@"cs2 - %@",  [cs2  longcharacterismember:utf32char] ? @"yes" : @"no"); nslog(@"cs3 - %@",  [cs3  longcharacterismember:utf32char] ? @"yes" : @"no");  nslog(@"mcs1 - %@", [mcs1 longcharacterismember:utf32char] ? @"yes" : @"no"); nslog(@"mcs2 - %@", [mcs2 longcharacterismember:utf32char] ? @"yes" : @"no"); 

i following output:

cs1 - yes cs2 - no cs3 - no mcs1 - yes mcs2 - no 
  1. why cs1 seem work correctly (for immutable character sets)?
  2. why order important mutable character sets?

is bug? known problem objc's internal utf-16 representation (is still case?)?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -