IOS Emoji Emoticons/decode

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.