I'm facing a problem about displaying emoji in a UILabel. I get this data from a web service (i cannot change the way i get the data) : This value is from the debugger :
__NSCFString * @"emoji \\ud83d\\ude1b\\ud83d\\ude1d" 0x000000017405ea80
Value from NSLog :
emoji \ud83d\ude1b\ud83d\ude1d
if i assign this value to my UILabel text property i get on the screen :
emoji \ud83d\ude1b\ud83d\ude1d
I tried to encode and decode the string using :
NSData *data = [string dataUsingEncoding:NSNonLossyASCIIStringEncoding];
NSString *dataValue = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return dataValue;
and when i try :
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
NSString *output = [[NSString alloc] initWithData:data encoding:NSNonLossyASCIIStringEncoding];
i get the emoji on the screen but if a string does not have emoji inside it will be nil and get empty label on device.
I can't get it to work correctly.
Thanks for any help.