:
1. Apple hosed NSString WRT UTF Planes 1 , UTF-16. , length 2 .
2. , emoji Plane 1, , 1 UTF .
( @Hot Licks):
OP emoji
NSString *uniText = @"💦💏👒👒💦";
NSDictionary* jsonDict = @{@"title":uniText};
NSData * utf32Data = [uniText dataUsingEncoding:NSUTF32LittleEndianStringEncoding];
NSLog(@"utf32Data: %@", utf32Data);
NSError* error = nil;
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:jsonDict options:0 error:&error];
if (jsonData == nil) {
NSLog(@"JSON serialization error: %@", error);
}
else {
NSString* jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"The JSON result is %@", jsonString);
NSLog(@"jsonData: %@", jsonData);
}
NSLog
utf32Data: a6f40100 8ff40100 52f40100 52f40100 a6f40100
JSON: { "title": "💦💏👒👒💦" }
jsonData: 7b227469 746c6522 3a22f09f 92a6f09f 928ff09f 9192f09f 9192f09f 92a6227d