Reputation: 77596
I am using NSNumberFormatter to create a currency formatted string. Everything works fine on most devices, but on some devices for example devices with Korean language, the $ sign shows up as a rectangle.
NSNumberFormatter *currencyStyle = [[NSNumberFormatter alloc] init];
[currencyStyle setFormatterBehavior:NSNumberFormatterBehavior10_4];
[currencyStyle setNumberStyle:NSNumberFormatterCurrencyStyle];
NSNumber *amount = [NSNumber numberWithInteger:moneyAmount];
NSString *amountString = [NSString stringWithFormat:@"%@", [currencyStyle stringFromNumber:amount]];
[currencyStyle release];
Any way to fix this problem?
Rhanks
Upvotes: 0
Views: 559
Reputation: 11330
Given your comment in the question, it sounds like you just want the $
currency symbol, regardless of whatever the defined currency symbol is for the user's current locale.
This is done using the -setCurrencySymbol:
instance method of the NSNumberFormatter
class. In your case, you could do the following:
[currencyStyle setCurrencySymbol:@"$"];
Upvotes: 2