tags:

views:

35

answers:

2

Hi there. 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.
A: 
NSString *aString = [NSString stringWithUTF8String:"To be continued\u2026"];

(Courtesy of http://www.cocoadev.com/index.pl?UniCode)

Kalle
thanks for the answer. This is working so far i got the raw c string representation of the unicode char. However when i got the NSString representation it dont work. say i got: NSString *currency = "\u2026"; [NSString stringWithUTF8String:[currency cString]; is not working.
Diallo
A: 

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]] : @"$";`
Diallo