"ud83dude04"
is the JSON Unicode escape sequence for U+D83D U+DE04
, which is the "surrogate pair" for the Unicode U+1F604 (SMILING FACE WITH OPEN MOUTH AND SMILING EYES).
But NSJSONSerialization
decodes this correctly, as can be seen in the following example:
const char *jsonString = "{ "emoji": "\ud83d\ude04" }";
NSLog(@"JSON: %s", jsonString);
NSData *jsonData = [NSData dataWithBytes:jsonString length:strlen(jsonString)];
NSError *error;
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
self.myLabel.text = [jsonDict objectForKey:@"emoji"];
NSLog(@"Emoji: %@", self.myLabel.text);
Output:
JSON: { "emoji": "ud83dude04" }
Emoji: ??
and the Emoji symbol is also displayed correctly (tested with iPhone device and Simulator).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…