Special characters in the URL
Some symbols cannot be directly transmitted in the URL. If you want to pass these special symbols in the URL, you need to use their encoding. The encoding format is % plus the characters' ASCII code, that is, a percent sign %, followed by the corresponding characters' ASCII (hexadecimal) code value. For example, the Space Encoding value is "% 20 ".
The following table lists some special URL symbols and codes.
: Replace with % 3A
| |
|
|
Hexadecimal value |
| 1. |
+ |
The plus sign in the URL indicates space. |
% 2B |
| 2. |
Space |
Spaces in the URL can be encoded with a plus sign (+ ). |
% 20 |
| 3. |
/ |
Separate directories and subdirectories |
% 2f |
| 4. |
? |
Separate actual URLs and Parameters |
% 3f |
| 5. |
% |
Special characters |
% 25 |
| 6. |
# |
Indicates bookmarks |
% 23 |
| 7. |
& |
Delimiter between parameters specified in the URL |
% 26 |
| 8. |
= |
The value of the specified parameter in the URL. |
% 3d |
For example, to pass the string "This % is # Te = sT & o k? +/"Is transmitted to te. ASP as the parameter T. The URL can be:
Te. asp? T = This % 25is % 23te % 3dst % 26o % 20 K % 3f % 2B % 2f or
Te. asp? T = This % 25is % 23te % 3dst % 26o + K % 3f % 2B % 2f (spaces can be replaced by % 20 or +)
URL encoding and decoding functions in Java
Java.net. urlencoder. encode (string S) and java.net. urldecoder. Decode (string S );
URL encoding and decoding functions in Javascript
Escape (string S) and Unescape (string S );
From: http://blog.csdn.net/steven2006/article/details/1931647