Base64string parsing issues with. NET returned by iOS

Source: Internet
Author: User

1.c# generating code for BASE64 strings

String BODY = "{\" title\ ": \" last CVR khaki \ ", \" url\ ": \" Http://www.baidu.com\ "}"; byte[] Bodydata = System.Text.Encoding.Default.GetBytes (body); string Bodybase64  = convert.tobase64string ( Bodydata);

2. I parse the code (habitual notation)

NSData * contentdata=*contentdatajsonstring=[[nsstring alloc] initwithdata:contentdata encoding: Under the nsutf8stringencoding];//test

Out is garbled, I will change the code, changed together or not resolved, and then a think of the national Standard Code, a try gb_2312_80 special or can't parse, the dead horse when live horse medicine

Mentality to try another one of the national standard Code, finally out, and later still need to communicate well, otherwise it will appear this problem, if a start back-end coding with UTF8 will not appear this question

The problem. The following is the revised code (preferably the back end of the code).

NSData * Contentdata=[tool Base64StringtoNSData:mode.content]; Nsstringencoding enc = cfstringconvertencodingtonsstringencoding (kcfstringencodinggb_18030_2000); NSString *contentdatajsonstring=[[nsstring alloc] Initwithdata:contentdata Encoding:enc];

Base64string parsing issues with. NET returned by iOS

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.