create a NSString from the \uXXXX representation
I need to display the EURO (€,$,£) sign inside my UI. those sign are stored inside a SQLite database with theire \uXXXX representations. How can i create theire NSString representation?
Here is a sample of code:
NSString *currency = [[OptionDAO sharedInstance] readStringOption:@"TEST"
开发者_运维问答 strName:@"currency"
strGroup:@"NONE"]; // currency now contains "\u34AC" for instance.
NSString *aString = [NSString stringWithUTF8String:"To be continued\u2026"];
(Courtesy of http://www.cocoadev.com/index.pl?UniCode)
I've found out a solution. `NSString *currency = [[OptionDAO sharedInstance] readStringOption:[ctrlParent selectedCompany].SupplierID strName:@"currency" strGroup:@"NONE"];
NSData *ccc = [currency dataUsingEncoding:NSUTF8StringEncoding];
currency = [currency length] != 0 ? [NSString stringWithUTF8String:[ccc bytes]] : @"$";`
精彩评论