Javascript URL 转义字符

王朝学院·作者佚名  2009-01-16
窄屏简体版  字體: 小  |  中  |  大  |  超大  

我另外添加了附注。

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”

附注:URL编码规则

1、对每个字节进行编码;

2、空格转为”+”号;

3、安全字符不编码。安全字符:大小写英文字母(a-z以及A-Z) 阿拉伯数字(0-9) ’ ( ) * - . _ !

4、其他字节以十六进制显示并加”%”前缀,例如用%25代表%号。

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航