"Front-end JS, background C #" encoding decoding.

Source: Internet
Author: User

Recently did the project, appeared the problem of Chinese garbled, specially study.

GB2312, refers to the Chinese

UTF8, refers to the national standard, including Chinese, English.

However, by the Jquery.ajax get, Post, if you pass the Chinese or special characters of the envoy character, this time will appear garbled.

JS code encodeURI: For URLs, not escaped/&

encodeURIComponent: For parameters, Escape/&, if parameters have/& these symbols, use this.

JS decoding decodeURI: For URLs, not escaped/&
decodeURIComponent: For parameters, Escape/&, if parameters have/& these symbols, use this.

C # encoding uri.escapeuristring for URLs, not escaped/&

Uri.escapedatastring for parameters, Escape/& if parameters have/& these symbols, use this.

C # decoding Httputility.urldecode (string s)

"Front-end JS, background C #" encoding decoding.

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.