Basic concepts of 1.URL codingURLs can only be sent over the Internet using the US-ASCII character set. Because URLs often contain characters outside of the ASCII collection, URLs must be converted to valid ASCII formats. URL encoding uses a "%"
Php URL decode function corresponding to JavaScript URL encode function
1. Try using JS's encodeURI (), encodeURIComponent (), Escape () function for URL encoding,2. Using PHP UrlDecode function decoding, the results can not be decoded into normal
This article mainly describes how to decode the url through js when passing Chinese parameters. For more information, see if the parameters are:
The Code is as follows:
$ {Name}
The js for getting url parameters is as follows:
The Code is
Although escape (), encodeuri (), and encodeuricomponent () methods can affect the URL integrity
Character filtering. But the latter two is to convert the string to the UTF-8 way to transfer, solve the problem caused by inconsistent page
If an encoding is required, it indicates that this is not suitable for transmission. There are a variety of reasons, such as a large size that contains private data. For a URL, encoding is required because some characters in the URL may cause
Special character escaping encoding in URL URLsDecember 29, 2017 09:10:57Hits:Special character escaping encoding in URL URLsCharacter-URL encoded valueSpaces-%20"-%22#-%23%-%25&-%26(-%28)-%29+-%2B,-%2c/-%2F:-%3a; -%3b=-%3d>-%3e? -%3f@-%40\-%5C|
The encodeURI () function encodes a string as a URI.GrammarencodeURI (uristring)
Parameters
Description
Uristring
Necessary. A string that contains the URI or other text to encode.
return valueA
Usually if something needs to be coded, it means that something is not suitable for transmission. There are a variety of reasons, such as size too large to contain private data, and for URLs, the reason for encoding is because some characters in the
We all know that the transmission of the parameters in the HTTP protocol is a "Key=value" in the form of a, if you want to pass multiple parameters, you need to use the "&" symbol to split the key value pairs. such as "? Name1=value1&name2=value2",
For example, in a URL parameter string, the Key=value key value is used to pass the argument, and the key value pairs are separated by & symbols, such as/s?q=abc&ie=utf-8. If your value string contains = or, it is bound to result in a server parsing
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.