Quantcast
Viewing latest article 4
Browse Latest Browse All 4

Unicode not working properly in iOS

My unicode is \u20AC when I set it on UILabel but I'm getting unicode on label. Some time it is printing euro but mostly it is printing unicode on label.

My code is over here

    NSLog(@"Currecy %@",currencySymbol);    UILabel *priceLbl = [[UILabel alloc] initWithFrame:CGRectMake(180, 10, 45, 25)];    priceLbl.textColor = [UIColor whiteColor];    priceLbl.textAlignment = NSTextAlignmentCenter;    priceLbl.font = [UIFont fontWithName:@"ProximaNova-Bold" size:15];    priceLbl.tag  = 1001;    fair = [NSString stringWithFormat:@"%d",arc4random()%50];    priceLbl.text = [NSString stringWithFormat:@"%@ %@",fair,currencySymbol];

OutputCurrecy \u20AC

Printing description of priceLbl:<UILabel: 0x7faade3095a0; frame = (185 10; 50 25); text = '\u20AC'; userInteractionEnabled = NO; tag = 1001; layer = <_UILabelLayer: 0x7faadbd91bb0>>

Image may be NSFW.
Clik here to view.
enter image description here

And I'm trying to set at my end getting output as I would like. for example

Image may be NSFW.
Clik here to view.
enter image description here

Getting server response

{    currency = "\\u20AC";    description = "You have been successfully logged in.";}and the currency symbol replacing "\\" with "\"NSString *currency = [response[@"currency"] stringByReplacingOccurrencesOfString:@"\\\\" withString:@"\\"];

Viewing latest article 4
Browse Latest Browse All 4

Trending Articles