The urlencode function URL-encodes the incoming string parameters. Except for "ˉ—.", all non-alphanumeric characters in the returned string are replaced with a percent sign (%) followed by two hexadecimal digits, and spaces are encoded as plus signs (+). This function facilitates encoding the string and using it in the request part of the URL, and also facilitates passing variables to the next page.
URLEncode: refers to an encoding conversion method for Chinese characters in web page URLs. The most common one is that when Chinese queries are entered in search engines such as Baidu and Google, an encoded web page URL is generated. There are generally two methods of URLEncoding. One is the traditional Encode based on GB2312 (used by Baidu, Yisou, etc.), and the other is based on UTF-8 Encode (used by Google, Yahoo, etc.). This tool implements two methods of Encode and Decode respectively.
is encoded into the GB2312 html file, http://www.nowamagic.net/中文.rar -> The browser automatically converts it to -> http://www.nowamagic. net/%D6%D0%CE%C4.rar
Note: Firefox does not support the Chinese URL of GB2312 Encode because it defaults to UTF-8 encoding to send the URL, but the ftp:// protocol Can.
In the html file encoded as UTF-8, http://www.nowamagic.net/中文.rar -> The browser automatically converts to -> http://www.nowamagic.net/ %E4%B8%AD%E6%96%87.rar
URLEncode in PHP:
All non-alphanumeric characters except -_. will be replaced with a percent sign (%) followed by two hexadecimal digits.
The difference between urlencode and rawurlencode:
If you want to use UTF-8 Encode, there are two methods:
Example:
URLEncode in JavaScript: %E4%B8%AD%E6%96%87-_.%20%E4%B8%AD%E6%96%87-_.%20, encodeURI does not encode the following characters: Special characters such as ":", "/", ";", "?", and "@".
|