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.