????1. ????
?????????????????????????棺???????????java?????????url????????????
????????????????У?????"????"????????????????????????GB2312??????"d6d0cec4"??Unicode?????"4e2d 6587"??UTF??????"e4b8ad e69687"????????????????iso8859-1????????????iso8859-1??????"???"??
????2. ?????????
????????????iso8859-1????ascii?????????????????????????????????????????????????????????????????
????2.1. iso8859-1
????????????????????????????Χ??0-255????????????С????磬???'a'??????0x61=97??
???????????iso8859-1?????????????Χ??????????????????????????????????????????????????????λ??£????????????????iso8859-1???????????????????Э???????????????
????2.2. GB2312/GBK
???????????????????????????????????????????????????iso8859-1??£?????iso8859-1??????????gbk???????????????????????????????gb2312????????????gbk?????gb2312??????
????2.3. unicode
????????????????????????????????????????????????????????????????????????????????????????????????????iso8859-1??????????????κα??????????????iso8859-1?????????uniocode?????????????????????0???????????'a'?"00 61"??
??????????????????????????????????????GB2312/GBK???????????????unicode????????????????????????????????????????unicode????????????????java??
????2.4. UTF
?????????unicode????????iso8859-1????????????????????????????????????unicode??????????????????????unicode???????????洢????????????utf????utf???????iso8859-1??????????????????????????????????????utf????????????????????????????1-6?????????????utf???????????У?鸚???????????????????????????????????????????????????
???????????utf????????????????????????????????unicode?????????????????????????????GB2312/GBK?????????????????????棬??????????????utf???????????3???????????????????????utf????????unicode???????????????а????????????????
????3. java??????????
??????java???????У????ж??漰?????????????Щ??????????????????????Щ?????????????????????
????3.1. getBytes(charset)
????????java??????????????????????????????????????????????????charset????????????????????????????java??????????unicode????洢???????"????"??????????£?????д????????洢?"4e2d 6587"?????charset?"gbk"?????????"d6d0 cec4"??????????"d6 d0 ce c4"?????charset?"utf8"?????"e4 b8 ad e6 96 87"???????"iso8859-1"??????????????????? "3f 3f"????????????
????3.2. new String(charset)
????????java?????????????????????????????????????????????????????鰴??charset???????????????????unicode?洢???ο?????getBytes???????"gbk"??"utf8"??????ó????????"4e2d6587"????iso8859-1??????"003f 003f"????????????
???????utf8???????????/?????????????????new String( str.getB+ytes( "utf8" )?? "utf8") === str??????????檔
????3.3. setCharacterEncoding()
?????ú???????????http???????????????
????????request??????????????????????????getParameter()?????????????????????????????????????iso8859-1??????????????????μ?????"???????"????????????????setCharacterEncoding()????????????κ?getParameter()??javadoc???????This method must be called prior toreading request parameters or reading input using getReader()???????????????POST??????Ч????GET??????Ч??????????????????е????getParameter()?????java???????????????е????????????????getParameter()??????з?????????setCharacterEncoding()??Ч????????GET??????????????????????URL?У?????????????????????е????????setCharacterEncoding()?????Ч??
????????response???????????????????????????????????????????????????????????????????