encodeURI与encodeURIComponent
js对url进行编码涉及3个函数:escape,encodeURI,encodeURIComponent, 相应3个解码函数:unescape,decodeURI,decodeURIComponent 1、encodeURIComponent encodeURIComponent() is a global function that returns an encoded copy of its s argument. ASCII letters and digits are not encoded, nor are the following ASCII punctuation characters: - _ . ! ~ * ' ( ) All other characters, including punctuation characters such as /, :, and # that serve to separate the various components of a URI, are replaced with one or more hexadecimal escape sequences. Note the difference between encodeURIComponent() and encodeURI(): encodeURIComponent(