objective c - unicode assignment failing in NSString? -


the following fails both unichar assignments?

unsigned int c = 0x0001d122; [nsstring stringwithformat:@"\u%@", [nsstring stringwithformat:@"%08x", c]]; [nsstring stringwithformat:@"\u%08x", c]; 

i trying programmatically (adding in "\u" makes things difficult seen above):

nsssymbol = @"\u0001d122"; \\this works... need able vary 'c'  

the handling of \unnnnnnnn construct in string literal done @ compile time. can't build construct @ run time , have interpreted. that's not how things work.

you do:

uint32_t c = 0x0001d122; nsstring* s = [[nsstring alloc] initwithbytes:&c length:sizeof(c) encoding:nsutf32littleendianstringencoding]; 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -