I've added a p.s.
1.
encodeURIComponent("[string]")
decodeURIComponent("[encodedString]")
2.
encodeURI("[string]")
decodeURI("[encodedString]")
3.
escape("[string]")
unescape("[encodedString]")
Note:
a. The both of 1 and 2 encodes/decodes in “utf-8″
b. The both of 1 and 2 can not encode _-~*.'
c. The difference of 1 and 2 is 2 can not encoding /?&+=$@,;
d. The 3 encodes/decodes in “ISO Latin”
Note: URL encoding rules
1. Encode each byte;
2. Convert spaces to "+" signs;
3. Security characters are not encoded. Safe characters: uppercase and lowercase English letters (az and AZ) Arabic numerals (0-9) ' ( ) * - . _!
4. Other bytes are displayed in hexadecimal and prefixed with "%", for example, use %25 to represent the % sign.