special characters in the URL
Some symbols cannot be passed directly in the URL, and if you want to pass these special symbols in the URL, they will be encoded. The encoded format is: The ASCII code of the% plus character, which is a percent percent, followed by the ASCII (16-binary) code value of the corresponding character. For example, the encoded value of a space is "%20".
Some URL special symbols and codes are listed in the following table.
: Replaced by%3a
|
|
|
10 Six binary values |
1. |
+ |
the + sign in the URL represents a space |
%2b |
2. |
space |
The spaces in the URL can be used with the + number or code |
%20 |
3. |
/ |
separating directories and subdirectories |
%2f |
4. |
? |
separating the actual URLs and parameters |
%3f |
5. |
% |
Specify special characters |
%25 |
6. |
# |
represents a bookmark |
%23 |
7. |
& the delimiter between the parameters specified in the |
URL |
%26 |
8. |
= |
the value of the parameter specified in the URL |
%3d |
Example: To pass the string "This%is#te=st&o k?+/" as the parameter T to te.asp, the URL can be:
TE.ASP?T=THIS%25IS%23TE%3DST%26O%20K%3F%2B%2F or
TE.ASP?T=THIS%25IS%23TE%3DST%26O+K%3F%2B%2F (spaces can be replaced with%20 or +)
Encoding and decoding functions for URLs in Java
Java.net.URLEncoder.encode (string s) and Java.net.URLDecoder.decode (string s);
Encoding and decoding functions for URLs in JavaScript
Escape (string s) and unescape (string s);
Special character handling notes in URLs