The path contains Chinese characters and Chinese characters.

Source: Internet
Author: User

The path contains Chinese characters and Chinese characters.

During project creation, we may encounter the need to use path-based parameter transfer. If the parameter is a number or English, no garbled characters will occur. But what if the parameter passing happens to be a Chinese character? The chance of garbled characters is very high. The passed parameters become unknown and cannot be processed in the background. Today, I encountered such a problem, which caused me a tangle and not much nonsense. The following describes the method:

If you want to pass Chinese parameters through the path, we need to first process the path, so we have used the javascript encodeURI () function for a long time. The specific usage of this method is as follows:

This is the specific usage provided by w3chool. It is to input a required string in the function, which contains URI or other text to be encoded. There are also some of the above that will not be translated,

Encode the code when it is passed at the front end, and then parse the code when taking the parameters in the backend. However, some problems may occur during encoding, that is, the parameters received in the background After encoding are still incorrect. How can this problem be solved?

The following reference a great god Blog content: Address: http://blog.163.com/eugeneheen_chen@126/blog/static/120812157201291994916866/

The above method has been tested to be excellent, so you can use it with confidence.

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.