`

Java javascript url转码

 
阅读更多

 

JS:关于URL转码,其中特殊字符的处理方式:

alert('escape:'+escape(rs));

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

 

alert('encodeURI:'+encodeURI(rs));

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

 

alert('encodeURIComponent:'+encodeURIComponent(rs));

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

 

---------------------------------------------------------------------------------------------------------------------

 

java 对URL特殊字符的处理:

java.net.URLEncoder.encode(tdc.getEncryptContext(), "utf-8")

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics