Last active
August 29, 2015 14:03
-
-
Save mindbrix/710707d3dec311196e5e to your computer and use it in GitHub Desktop.
Unicode char to NSString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *hexString = @"1F0A7"; | |
unsigned int character; | |
NSScanner* scanner = [NSScanner scannerWithString:hexString ]; | |
[ scanner scanHexInt:&character ]; | |
UTF32Char inputChar = NSSwapHostIntToLittle(character); // swap to little-endian if necessary | |
NSString *str = [[NSString alloc] initWithBytes:&inputChar length:4 encoding:NSUTF32LittleEndianStringEncoding]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment