Trying to convert strings that contain an escaped unicode (ex: \u3400) in the range of U+20000 to U+2B81F to form URLs, but it’s not working. The range U+3400 to U+9FFF works just fine.
NSString *string1 = @"\u9FFF";
string1 = [string1 stringByReplacingPercentEscapesUsingEncoding:NSUnicodeStringEncoding];
NSURL *url1 = [NSURL URLWithString:[NSString stringWithFormat:@"http://en.wikipedia.org/Search?search=%@", string1]];
NSLog(@"url1: %@", url1);
OUTPUT: url1: http://en.wikipedia.org/Search?search=%E9%BF%BF
NSString *string2 = @"\u20000";
string2 = [string2 stringByReplacingPercentEscapesUsingEncoding:NSUnicodeStringEncoding];
NSURL *url2 = [NSURL URLWithString:[NSString stringWithFormat:@"http://en.wikipedia.org/Search?search=%@", string2]];
NSLog(@"url2: %@", url2);
OUTPUT: url2: (null)
Basically, what I want is to convert a list of escaped unicodes (\u3400 to \u2B81F) to URLs (or even NSStrings). If there is another way to achieve this by other string conversion means, I’ll be thankful.
I don’t know why you’re trying to de-escape a Unicode char, when NSString is already UTF-8 encoded:
EDIT: I’ve got it! It sure doesn’t NSLog() at all, but it ain’t (null), and that’s all that matters.