Problems encountered during URL codec of front-end transfer string in actual project

Source: Internet
Author: User

In the online version (including version 12.2, 12.3), the reference filter conditions in the transmission process through the URL encoding and decoding process, the use of the front and back of the API differences caused some problems, is now recorded as follows:


Front-end URL encoding API

encodeURIComponent URL encoding of strings using the UTF-8 encoding format;


Backend URL Decoding API: The following three decoding methods are present in the code:

System.Web.UI.Server.UrlDecode, there is a problem: Cannot parse%2b to +, output is white space character;

Microsoft.JScript.GlobalObject.unescape, there is a problem: can only use Unicode encoding format, and the front-end API used by the UTF-8 encoding format does not match, the specific problem is that Chinese characters can not be decoded correctly;

System.Web.HttpUtility.UrlDecode, there is a problem: You can specify the encoding format, easy to match the UTF-8 encoding format used by the front-end API, but the decoding of%2B is a non-idempotent, the first decoding can be correctly resolved to +, and the + Decoding will output white space characters;

In view of the above problems, in the service-side decoding process, it is necessary to carefully consider the various scenarios (including front-end, domain) of the codec, the number of times (inclusion BASE64 encoding) and other factors to decode.

Problems encountered during URL codec of front-end transfer string in actual project

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.