JS中编码解码方法

encodeURIComponent

decodeURIComponent

 

 

encodeURI 

decodeURI 

 

 

escap

unescape 

 

escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z 

encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z 

encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z 

 

escape对0-255以外的unicode值进行编码时输出%u****格式,其它情况下escape,encodeURI,encodeURIComponent编码结果相同。 

unescape 方法返回一个包含 charstring 内容的字符串值。所有以 %xx 十六进制形式编码的字符都用 ASCII 字符集当中等效的字符代替。以 %uxxxx 格式(Unicode 字符)编码的字符用十六进制编码 xxxx 的 Unicode 字符代替

 

posted @ 2012-07-21 10:54  xylem  阅读(437)  评论(0)    收藏  举报