I have a unicode hex value in an NSString - how do I output the character; here\'s what I have:
NSLog(@\"\\U0001D000\");
NSMutableString *hexString = [[NSMu
If your character requires a surrogate pair (U+10000 to U+10FFFF), use CFStringGetSurrogatePairForLongCharacter
to convert the Unicode code point into a UTF-16 surrogate pair, and then -initWithCharacters:length:
to convert it into an NSString. For example:
UniChar c[2];
CFStringGetSurrogatePairForLongCharacter(0x1D000, c);
NSString *s = [[NSString alloc] initWithCharacters:c length:2];
For other characters (CFStringGetSurrogatePairForLongCharacter
returns FALSE
), you can skip the conversion and go straight to -initWithCharacters:length:
.