JavaScript-front-end JS JSON string Base64_encode encoding, submit back-end Chinese garbled

Source: Internet
Author: User
Business process

Front end based on related business
1. String types for array-to-JSON
2. Base64_encode the JSON string
3. Submit Back-end

Now the problem is the front-end submission of the Base64, as long as with the Chinese, will become garbled, online to find some way is not a perfect solution, to solve the browser on the Base64 encryption and decryption after the Chinese garbled problem.

Reply content:

Business process

Front end based on related business
1. String types for array-to-JSON
2. Base64_encode the JSON string
3. Submit Back-end

Now the problem is the front-end submission of the Base64, as long as with the Chinese, will become garbled, online to find some way is not a perfect solution, to solve the browser on the Base64 encryption and decryption after the Chinese garbled problem.

JSON use UTF-8, you use Base64 code, after the service side do Base64 decoding, also as UTF-8 processing, if as GBK will be garbled.

Ps:base64 is not a cryptographic algorithm.

  • Related Article

    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.