????5. URL???
????URL????к??????????????鷳???????????????GET???????????????????GET??????????????????URL?С?
????5.1. URL????
????????URL?е??Щ??????????????????????б?????Щ???????"/?&"??????????unicode????????紡?????????????????
????IE????????"???????UTF-8????URL"???????????Ч???IE????????????????UTF-8??????????URL??????????????Ч?????????????"GBK"???????????URL?????????????URL????????????????????б???????UTF-8?????Ч??????"????.html?a=????"????UTF-8?????Ч?????????????"%e4%b8%ad%e6%96%87.html?a=x4ex2dx65x87"????UTF-8?????Ч?????????????"x4ex2dx65x87.html?a=x4ex2dx65x87"????????????"????"?????????4??????????????18????????????URL????????
??????web server??tomcat???????????????????????URL?????????"%"????????ISO8859-1????????????????????????URLEncoding?????ó????????????????????????????"ue4ub8uadue6u96u87.html?a=u4eu2du65u87"??"u4eu2du65u87.html?a=u4eu2du65u87"????????????"????"????????????6?????????????"u"???????unicode??
?????????????????????????????????????????????????????????????????????????????к??????????????е?????????????????UTF-8???????????????????????????????
????5.2. rewrite
?????????????????apache?????????????rewrite??飬?????????書???????????????????????URL???????%?????????????web server??tomcat???????????????????????????????[NE]?????????ù???????????鰱δ???????????????汾??????????apache 2.0.54?????????????????к???"?& "??????????ù???????????ò????????????
????rewrite??????????????????????????????????????????????????????????????
????5.3. URLEncode.encode()
????????Java?????????URL?????????????????????UTF-8?????Ч???????????????????????????????java?????????????????????÷?????deprecated????????????????????????????
????????????????????÷?????????????????????????н???ò?????????????"????"?????????????"gb2312"????????"%4e%2d%65%87"???????????"UTF-8"????????"%e4%b8%ad%e6%96%87"????????????????????????????????????????????tomcat??????????LC_ALL??LANG?????????????????tomcat?????????????????????????????????????????????????????????
??????????????"UTF-8"??????????????????????
????5.4. ??????????
????????????????????????????????????????????web server????????????????????????????????м?????????????Э??????????????
??????????????????y?????????п????IE???????UTF-8??Ч??????????????????????IE????????????????????????????webserver?????á???????????????????????????????????????????????????????????????UTF-8??
??????????????UTF-8???????й???????????????????????????????????????ж???????????UTF-8???????????????UTF-8????????????????????????????????"GBK"??????????????ж????UTF-8??????????????????????????????
????public static boolean isValidUtf8(byte[] b??int aMaxCount){
????intlLen=b.length??lCharCount=0;
????for(int i=0;i<lLen&& lCharCount<aMaxCount;++lCharCount){
????byte lByte=b[i++];//to fast operation?? ++ now?? ready for the following for(;;)
????if(lByte>=0) continue;//>=0 is normal ascii
????if(lByte<(byte)0xc0 || lByte>(byte)0xfd) return false;
????int lCount=lByte>(byte)0xfc?5:lByte>(byte)0xf8?4
????:lByte>(byte)0xf0?3:lByte>(byte)0xe0?2:1;
????if(i+lCount>lLen) return false;
????for(int j=0;j<lCount;++j??++i) if(b[i]>=(byte)0xc0) return false;
????}
????return true;
????}
?????????????????????????????????£?
????public static String getUrlParam(String aStr??StringaDefaultCharset)
????throws UnsupportedEncodingException{
????if(aStr==null) return null;
????byte[]lBytes=aStr.getBytes("ISO-8859-1");
????return new String(lBytes??StringUtil.isValidUtf8(lBytes)?"utf8":aDefaultCharset);
????}
???????????÷?????????????????????棺
??????а??????????????????????????????????????????ж??????????????????????????????????Щ??????????????????
?????????????ж?UTF-8??????????????"??"?????????GBK??????" xd1xa7xcfxb0"????????????isValidUtf8?????ж????????true??????????????????ж??????????????Ч??????
???????????????????google???????????????????????????????????????????????磬???????????????"http://www.google.com/search?hl=zh-CN&newwindow=1&q=??"??google??????????????????????????????????
????????ò????????£?????????rewrite?????????????????????????????????????????????????????????????????????????????????????????????????????y?????á?
????6. ????
?????????????Щ??????й??????????
????6.1. SecureCRT
?????????????????????????й????Щ?????????й?????????????SecureCRT????linux????????SecureCRT??????????????session???????в??????????????linux????????????????????????????Щ???????????????????
????????mysql???????????????????????SecureCRT????????????????????SecureCRT???sql???????????????????????????????????????????
????????Utf-8???????????????????±????????????????????????????????????????mysql???????????????????????????????????linux??vi????????????????????????????????????????????windows?£??????????txt??????ü??±?????????"???"??????????棬????????????????????????????С???
????6.2. ??????
????????????????????????filter?????????????????????filter class?У??????????????????????????????μ?????setCharacterEncoding()???????apache???????????????????????SetCharacterEncodingFilter??
????6.3. POST??GET
?????????????POST????????URL?и???????????????????????setCharacterEncoding()?????????????????GET?????γ??URL????????????????????????????????????
??????????????????????????GET?????????????????л?ò???????????????????????setCharacterEncoding()????????????????rewrite????????IE??UTF-8??????????????????URIEncoding????????URL?е??????
????6.4. ??????????
????GBK????????????????????????????????????????GBK???????????????????????????????????????????y????????????????????????UTF??GBK?е????з?????????????????????BIG5????????????????????????????????????????UTF????洢??
???????磬????"???????"????UTF????"xE8xAFxADxE8xA8x80 xE8xAAx9ExE8xA8x80"?????м????????????????????????? "xE8xAFxADxE8xA8x80>"??