I have an issue receiving a string from a PHP backend into my iOS app. The string I receive looks like this:
Test ððððð
Those special characters should be smileys. Now I checked with this encoder here: https://encoder.mattiasgeniar.be/index.php and the string is UTF-8 encoded indeed the one with smileys.
Test
Now I wonder what encoding is the source string? And how can I convert it to an UTF-8 string that displays correctly on iOS?
I've tried
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:@"Test ððððð" options:0];
NSString *message = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
and
NSString *message = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, (CFStringRef)@"Test ððððð", CFSTR(""), kCFStringEncodingUTF8);
and also
NSString *message = [@"Test ððððð" stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
but none of those worked. I kind of baffled what the source string is encoded like.