[NSString rangeOfCharacterFromSet:] ignores Unicode surrogate pair

Originator:Carter
Number:rdar://11583003 Date Originated:02-Jun-2012 07:05 PM
Status:Open Resolved:
Product:iPhone SDK Product Version:5.1.1
Classification:Other Bug Reproducible:Always
 
Summary:
[NSString rangeOfCharacterFromSet:] can't find the range of a Unicode surrogate pair.

Steps to Reproduce:
// I don't know if radar supports Unicode. In case it convert the following code into ASCII, replace "𝄞" in string with a musical G clef character (code point: 119070, hex: 1D11E).
NSString *s = [NSString stringWithUTF8String: "***𝄞***"];
NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString: [NSString stringWithUTF8String: "𝄞"]];

NSLog(@"%@", NSStringFromRange([s rangeOfCharacterFromSet: set]));

Expected Results:
(3, 2)

Actual Results:
(NSNotFound, 0)

Notes:
I found this originally filed (through Open Radar) as rdar://problem/6072645. That bug was marked as shipped, but I am still having the problem.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!