When href is needed to pass parameters, and the parameters are in Chinese, garbled characters will appear. The simplest method is: The passed value is first encrypted with escape() , and then decrypted with unescape() on the value access page. It has been tested and is effective. I checked online and found that urlencode can be used for encryption and urldecode can be used for decryption. Um... what is the difference between the two? I just checked and sorted it out, source (http://www.cnblogs.com/glory-jzx/archive/2013/06/14/3135580.html): js involves 3 functions to encode text : escape, encodeURI, encodeURIComponent, and 3 corresponding decoding functions: unescape, decodeURI, decodeURIComponent 1. When passing parameters, you need to use encodeURIComponent so that the combined URL will not be truncated by special characters such as #. >2. When redirecting URL, you can use encodeURI as a whole 5. The most commonly used one should be encodeURIComponent , which converts special characters such as Chinese and Korean into utf-8 URL encoding. Therefore, if you need to use encodeURIComponent to pass parameters to the background, the background decoding needs to support utf-8 (the encoding method in the form is the same as the encoding method of the current page) 6. No encoding: There are 69 escape characters: *, +, -, ., /, @, _, 0-9, az, AZ What is the difference between escape() and encodeURI()? escape() method: encodeURI() Method encodeURIComponent() method: [When is it appropriate to use which method?] I have only used escape, so this is for reference only. The above article about the Chinese garbled code problem in a href parameter passing is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. Original URL: http://www.cnblogs.com/zhangym118/archive/2016/07/05/5644915.html |
<<: Vue+Echart bar chart realizes epidemic data statistics
>>: HTML imitates Baidu Encyclopedia navigation drop-down menu function
1. Form <form id="" name=""...
How to recursively select all child elements usin...
1. Set up Chinese input method 2. Set the double ...
Table of contents 1. Anti-shake 2. Throttling 3. ...
Table of contents 1. Introduction 2. Installation...
Table of contents 1. Resources and Construction 1...
When I wrote the Redis book and the Spring Cloud ...
Rendering principle In the form element, there is...
Preface In the Linux kernel, in order to be compa...
CPU Load and CPU Utilization Both of these can re...
Distinguish the differences between the filter, f...
<br />Use of line break tag<br>The lin...
1. Introduction The EXPLAIN statement provides in...
Problem: The website published through IIS is pla...