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")
本文详细解读了JS中的escape、encodeURI、encodeURIComponent函数在URL转码时的不同处理方式,并对比了Java中对URL特殊字符的处理方法,提供了URL编码的深入理解。
1042

被折叠的 条评论
为什么被折叠?



