The expression encoding and decoding problem that was encountered while doing the barrage
Emoticons are generally encoded using Unicode encoding, followed by the encoded format \ud83d\ude18\ud83d\ude18world\u4e16\u754chaha\ud83d\ude17
//CodingNSString *unistr =[NSString Stringwithutf8string:[_barragetext.text utf8string]; NSData*unidata =[Unistr datausingencoding:nsnonlossyasciistringencoding]; NSString*goodstr =[[NSString alloc] Initwithdata:unidata encoding:nsutf8stringencoding]; NSLog (@"---encoding--->[%@]", GOODSTR); //decoding Const Char*jsonstring = [Goodstr utf8string];//JSON returned by the GOODSTR serverNSData *jsondata =[NSData datawithbytes:jsonstring Length:strlen (jsonstring)]; NSString*GOODMSG1 =[[NSString alloc] Initwithdata:jsondata encoding:nsnonlossyasciistringencoding]; NSLog (@"---decoding--->[%@]", GOODMSG1); .-Geneva- the Ten: -:17.858dfromwe[650:153981]---encoding--->[Hello\ud83d\ude18\ud83d\ude18world\u4e16\u754chaha\ud83d\ude17] .-Geneva- the Ten: -:17.859dfromwe[650:153981]---decode--->[hello???? World haha??]
IOS Emoji Emoticons/decode