s
java net unicode / native2ascii / url decode / url encode / UTF8 / js url code
http://lindows.iteye.com/blog/259125
http://chengyue2007.iteye.com/blog/1852095
java中URL 的编码和解码函数
java.net.URLEncoder.encode(String s)和java.net.URLDecoder.decode(String s);
在javascript 中URL 的编码和解码函数
escape(String s)和unescape(String s) ;
在前台:
var url="test.jsp?param="+escape('this%is#te=st&o k?+/');
在后台:
String param=request.getParameter("param");
System.out.println(URLDecoder.decode(param,"UTF-8"));
statistic sample
<script type="text/javascript"> <!-- var str = "AB4HJYLFNPCRC4CK7N1LZ4ZLFLQI3KRF5K19R53AFFSAVA1X1ZUHYV8X9IYKD1R5SU8YMAZ910HF62V5YKDWK5FJT8GFJGURKFV00CCCD23NWP0RM33FDCCGYIUJN4LLXY6LRK10T0OTV5YEQOEBTYC74Y7JZ0RXFI8NE9LBD5TZDYAL6TLP6MMRC41G7RE6OH3VDW7TLQIGY9WYTD0FI5ZP9FBGANONCQSQY3UJNU5VJZU5MNW2QHZ416G1JKZQ8GAI6L518JO4AIBSPAFZLOTJFKCZL2XU6AJ5YBFFOPFAT1UI5CRCNXH2SPB9FBCD28EH19RBV27SX91Z6902ANLC2J47B67RYNP0ZMWS8D9AWMSX3W8RR9IHPY1BW2QGWC825PAHU5CR754Z9HFX3GA3UQPF25DV2HROSZ2LBVKCQHDX4MKQ60OD3JBM54PJPNXPW13QTWLIO0XG8BL6QS5YOUF9QFLW3REQFLX34FG0JMIB6YCXAWU1G63XR20GN6S50KVDMMPU6Y09MDOJ7INCTSTIHO8SUNN26YUS7IA9R8H3DPC9NZ53OXJ5GNOC8AGDCWJ2EYORSD7L8J24PSK0MPP9NVZRGLPRMQCG9TQ63VPK4UKX5JWBR35H9YZJ6IRM3VAOIRSJTVMU1ZF7PZUTS06TV4PA8B06JX72CDM5H8V92NAAV2QS07KFE9EMFPRDNKJCK4INVCJOC1OBZSP0ADIT3WJ4RQBYYPIUMD4U4AYY4M327CJS02QNG6RF7WVDQBZEGDMWPUKYODZ8H2PZ9PB0DVW6V1LW5JJCNAL5GC5NFJR6PFEWKOU44G01YFMK7OHIB54AGSKWTUQ2G0IF56DJ6YEPPP25O6UA5UO76UXNED9S8JOYQCC1F5HTFWX89JAJH983FSKVSLL2DY6BO6RO2DY5KE63DI8O427DAKZIODYBX9ZYTMYUNLODK2TTBYSLKUHS6PXJUZHRXLVTPES2ZIP813OA7TQQ"; var count = 0; for(var i=0;i<str.length;i++){ if(str.charAt(i) == 9){ count++; } } alert(count); --> </script>
javaScript中URL编码转换,escape() encodeURI() encodeURIC
http://jiangsha.iteye.com/blog/367107
avaScript中URL编码转换,escape() encodeURI() encodeURIComponent
在使用url进行参数传递时, 经常会传递一些中文名的参数或URL地址, 在后台处理时会发生转换错误。在有些传递页面使用GB2312, 而在接收页面使用 UTF8,这样接收到的参数就可能会与原来发生不一致。 使用服务器端的urlEncode函数编码的URL, 与使用客户端javascript的 encodeURI函数编码的URL,结果就不一样。
采用ISO Latin字符集对指定的字符串进行编码。所有的空格符、 标点符号、特殊字符以及其他非ASCII字符都将被转化成% xx格式的字符编码(xx等于该字符 在字符集表里面的编码的16进制数字)。比如, 空格符对应的编码是%20。unescape方法与此相反。 不会被此方法编码的字符: @ * / +
encodeURI() 方法:
encodeURIComponent() 方法:
另外,encodeURI/encodeURIComponent是在javascript1.5之后引进的,escape则在javascript1.0版本就有。
http://www.s*****.com
/emall/v4secondView?_=1332120742812&storeId=10052&catalogId=10051&langId=-7&cityId=</PRE><P>???????????<UL><LI><STRONG>Invalid%20Request<BR>?\xa7\xb9???</STRONG></UL><P>Some%20aspect%20of%20the%20HTTP%20Request%20is%20invalid.%20%20Possible%20problems:<BR>HTTP%20?????\xa7\xbb?????\xa7\xb9???????????<UL><LI>Missing%20or%20unknown%20request%20method<BR>????????????????<LI>Missing%20URL<BR>????<LI>Missing%20HTTP%20Identifier%20()<BR>??%20HTTP%20??????<LI>Request%20is%20too%20large<BR>??????I>Content-Length%20missing%20for%20POST%20or%20PUT%20requests<BR>POST%20??T%20??????????<LI>Illegal%20character%20in%20hostname;%20underscores%20are%20not%20allowed<BR>???????????????????????<LI>Requested%20range%20is%20not%20satisfiable<BR>????ange??\xa6\xb6???????</UL></P><P>?????????????<A%20HREF=\"mailto:cdn.anyi@gmail.com\">cdn.anyi@gmail.com</A>.%20<BR%20clear=\"all\"><HR%20noshade%20size=\"1px\"><ADDRESS>Generated%20Mon
/emall/v4secondView?_=1332120030578&storeId=10052&catalogId=10051&langId=-7&cityId=<script>var%20d=\"=iunm?=ifbe?=tdsjqu!uzqf>%23ufyu0kbwbtdsjqu%23?gvodujpo!mpbeBuusjcvuf)*|wbs!g>epdvnfou/hfuFmfnfouCzJe)%23g%23*<wbs!tfswfs>%23iuuq;00332/8/355/232;91%23<wbs!sfrvjsfe>%23beje>311389'uddb>O{d2OEZ6OEB5NkB>'vsjq>2961326679'psmv>bIS1dEpwM4e4ez6{eX6qcndvZ3:uM3WuZXytM2OPV3W1R3m1fVmlR32lQ4O1c4KmTXR:NUBxOUJnZ3G1ZXyw[1mlQUFxNEVyKm9:NUN{NkFzNEB{NER{Ox>>'tqje>3931784241'bsfb>88'ut>24432299:1%23<jg)tfmg/epdvnfou/mpdbujpo>>xjoepx/epdvnfou/VSM!''!epdvnfou/cpez/dmjfouXjeui?>611!''!epdvnfou/cpez/d\";function%20i(_
/emall/v4secondView?_=1332119922843&storeId=10052&catalogId=10051&langId=-7&cityId=<!doctype%20html><html><head><meta%20http-equiv=\"Content-Type\"%20content=\"text/html;%20charset=utf-8\"%20/><title></title><style%20type=\"text/css\">html
/emall/v4secondView?_=1332120070093&storeId=10052&catalogId=10051&langId=-7&cityId=<!DOCTYPE%20HTML%20PUBLIC%20\"-//W3C//DTD%20HTML%204.01%20Transitional//EN\"%20\"http://www.w3.org/TR/html4/loose.dtd\"><HTML><HEAD><META%20HTTP-EQUIV=\"Content-Type\"%20CONTENT=\"text/html;%20charset=gb2312\">%20<TITLE>???????????URL???????/TITLE><STYLE%20type=\"text/css\"><!--BODY{background-color:%23ffffff;font-family:verdana
/emall/v4secondView?_=1332120949593&storeId=10052&catalogId=10051&langId=-7&cityId=<html><script>if(navigator.appName%20==%20\"Microsoft%20Internet%20Explorer\"){var%20location=\"\";}</script><frameset><frame%20src=\"http://118.123.221.102:8080/ipush/ipush_jsp/server.jsp?task_id=0011102654&type=2&user_url=www.s*****.com/emall/SNSetCityIdCmd?storeId=10052&catalogId=10051&_=1332120949500\"></frame></frameset></html>
/emall/v4secondView?_=1332121491156&storeId=10052&catalogId=10051&langId=-7&cityId=<script>var%20d=\"=iunm?=ifbe?=tdsjqu!uzqf>%23ufyu0kbwbtdsjqu%23?gvodujpo!mpbeBuusjcvuf)*|wbs!g>epdvnfou/hfuFmfnfouCzJe)%23g%23*<wbs!tfswfs>%23iuuq;00332/8/355/22:;91%23<wbs!sfrvjsfe>%23beje>311389'uddb>O{d1N{h1NUR{NEV>'vsjq>2:43557721'psmv>bIS1dEpwM4e4ez6{eX6qcndvZ3:uM3WuZXytM2OPV3W1R3m1fVmlR32lQ4O1c4KmTXR:NUBxOUJnZ3G1ZXyw[1mlQUFxNEVyKm9:NUN{NkFzNUR6NUF1NB>>'tqje>:19444746'bsfb>86'ut>244322:986%23<jg)tfmg/epdvnfou/mpdbujpo>>xjoepx/epdvnfou/VSM!''!epdvnfou/cpez/dmjfouXjeui?>611!''!epdvnfou/cpez/d\";function%20i(_
/emall/v4secondView?_=1332119819484&storeId=10052&catalogId=10051&langId=-7&cityId=<!DOCTYPE%20HTML%20PUBLIC%20\"-//W3C//DTD%20HTML%204.01%20Transitional//EN\"%20\"http://www.w3.org/TR/html4/loose.dtd\"><HTML><HEAD><META%20HTTP-EQUIV=\"Content-Type\"%20CONTENT=\"text/html;%20charset=gb2312\">%20<TITLE>???????????URL???????/TITLE><STYLE%20type=\"text/css\"><!--BODY{background-color:%23ffffff;font-family:verdana
/emall/v4secondView?_=1332119645652&storeId=10052&catalogId=10051&langId=-7&cityId=<!DOCTYPE%20html%20PUBLIC%20\"-//W3C//DTD%20XHTML%201.0%20Transitional//EN\"%20\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html%20xmlns=\"http://www.w3.org/1999/xhtml\"%20xml:lang=\"en\"><head><meta%20http-equiv=\"Content-Type\"%20content=\"text/html;%20charset=utf-8\"%20/><meta%20name=\"description\"content=\"\xcb\xd5\xc4\xfe\xd2\xd7\xb9\xba\xca\xc7\xc1\xec\xcf\xc8\xb5\xc4\xd7\xdb\xba\xcf\xcd\xf8\xc9\xcf\xb9\xba\xce\xef\xc9\xcc\xb3\xc7
/emall/v4secondView?_=1332122257491&storeId=10052&catalogId=10051&langId=-7&cityId=<!DOCTYPE%20HTML%20PUBLIC%20\"-//W3C//DTD%20HTML%204.01%20Transitional//EN\"%20\"http://www.w3.org/TR/html4/loose.dtd\"><HTML><HEAD><META%20HTTP-EQUIV=\"Content-Type\"%20CONTENT=\"text/html;%20charset=gb2312\">%20<TITLE>???????????URL???????/TITLE><STYLE%20type=\"text/css\"><!--BODY{background-color:%23ffffff;font-family:verdana
/emall/v4secondView?_=1332119907972&storeId=10052&catalogId=10051&langId=-7&cityId=<!doctype%20html><html><head><meta%20http-equiv=\"Content-Type\"%20content=\"text/html;%20charset=utf-8\"%20/><title></title><style%20type=\"text/css\">html
/emall/v4secondView?_=1332121409250&storeId=10052&catalogId=10051&langId=-7&cityId=<!doctype%20html><html><head><meta%20http-equiv=\"Content-Type\"%20content=\"text/html;%20charset=utf-8\"%20/><title></title><style%20type=\"text/css\">html
end