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
- why cs1 seem work correctly (for immutable character sets)?
- why order important mutable character sets?
is bug? known problem objc's internal utf-16 representation (is still case?)?
Comments
Post a Comment