UILabel + IRR, KRW and KHR currencies with wrong symbol
- by serb
Hi,
I'm experiencing issues when converting decimal to currency for Korean Won, Cambodian Riel and Iranian Rial and showing the result to the UILabel text.
Conversion itself passes just fine and I can see correct currency symbol at the debugger, even the NSLog prints the symbol well.
If I assign this NSString instance to the UILabel text, the currency symbol is shown as a crossed box instead of the correct symbol. There is no other code between, does not matter what font I use.
I tried to print ? (Korean Won) using the unicode value (0x20A9) or even using UTF8 representation (\xe2\x82\xa9), but all I get is the crossed box on the label.
Any other supported currency in iPhone SDK and NSLocale (nearly 170 currencies) works perfectly fine no matter how exotic the currency is.
Anyone else experiencing the same problem? Is there a "cure" for this?
Thanks
EDIT:
-(NSString *)decimalToCurrency:(NSDecimalNumber *)value byLocale:(NSLocale *)locale
{
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
[fmt setLocale: locale];
[fmt setNumberStyle: NSNumberFormatterCurrencyStyle];
NSString *res = [fmt stringFromNumber: value];
[fmt release];
return res;
}
lbValue.text = [self decimalToCurrency: price byLocale: koreanLocale];