views:

146

answers:

1

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];
A: 

Dear Serb, You have not any problem!!! you just use a limited (non)Unicode font.

in UI youshould display some character to users and IRR and KHR and etc are in different blocks of unicodeand the Fontyou are using to display to user shouldsupport allof them. I strongly recommand you to use Arial Unicode MS to ensure that you have Font issue or not.

if your problem resolved with font. You have to use a Unicode Font which support all of characters block - or create your own font

Nasser Hadjloo
Nasser, thank you for your answer. Unfortunatelly, this is not the solution. Arial Unicode MS solves Korean Won only. IRR and KHR symbol is still broken.
serb
Serb, I'msureyou have a font issue if you create unicode simbols, Can you tell me whats you characters (decimal) or unicode code? it is obvious which Arial Unicode MS support all characters and if you pass correct simbol to UI you should see correct simbols, So youare sending an invalid code to UI and want to see what youthink is right. ---------- Doyouuse a Standard Unicode Keyboard ? whats that and who standard it ? it may be aninvalid key code generation by your keyboard. please let meknow whats your keyboard layout ?
Nasser Hadjloo