Java??????????????о?
???????????? ???????[ 2014/3/26 10:43:05 ] ????????Java ????? ???
????3.4. ???????
????????????????д??????????????java??????й??????????????
????3.4.1. ???????
????User input *(gbk:d6d0 cec4) browser *(gbk:d6d0 cec4) web server iso8859-1(00d6 00d 000ce00c4) class???????class?н??д????getbytes("iso8859-1")?d6d0 ce c4??new String("gbk")?d6d0 cec4?????????unicode???????4e2d 6587??
?? ??????????????????????????й????????????????й?????????????????????gbk?????
?? ??browser??web server???????????????????????????????????????????????????????????url???????????????????????????????????????????????????????????????????????gbk?????????
????Web server??????????????????????getParameter??????iso8859-1???????????????????????????????д????????????????????????request.setCharacterEncoding ()?????????????????????????
???????????????????????????????????????????????????????
????3.4.2. ???????
?????????????gbk??????????????????????????gbk????iso8859-1???????????windows??????????????linux?????????????????????????????
????Jsp *(gbk:d6d0 cec4) java file *(gbk:d6d0cec4) compiler read uincode(gbk: 4e2d 6587; iso8859-1: 00d600d 000ce 00c4) compiler write utf(gbk: e4b8ad e69687;iso8859-1: *) compiled file unicode(gbk: 4e2d 6587; iso8859-1: 00d600d 000ce 00c4) class????????gbk?????棬????iso8859-1????????????????
????class unicode(4e2d 6587) system.out /jsp.out gbk(d6d0 cec4) os console / browser??
???????????????????????棬????windows?£?????ansi/gbk??
????????????????????????????????????δ?????????????????????class?????????????????????????????????????????jsp??????????????windows?±????棬???????????linux??????/???????????????????????jsp???????pageEncoding???????
????Java??????????????????unicode?????????????????????utf????
?????????????????????????????????????????windows?£?System.out?????gbk??????????response????????????????jsp?????????contentType?????????????response????????????????browser???????????δ???????????iso8859-1?????????????????browser????????????????
????l browser??????????????????response??????????jsp?????????contentType????????response????????δ????????????????meta??????е?contentType??
????3.5. ????????
????????web??ó?????????й?????????????????
????3.5.1. jsp????
????????????洢????????????????????????????????????磺<%@pagepageEncoding="GBK"%>?????????????class?????????????????????????
????3.5.2. jsp???
???????????????browser???????????????????????????????????磺<%@ pagecontentType="text/html; charset= GBK" %>???????ú?response.setCharacterEncoding("GBK")??Ч??
????3.5.3. meta????
??????????????????????????????????????á?????????????????jsp??????????????????response.setCharacterEncoding()?????磺<META http-equiv="Content-Type"content="text/html; charset=GBK" />
???????????????jsp?????meta?????????????????????jsp?????????????jsp??????????????response?С?
??????????????apache???????????????????????????????????????????jsp??????????????????????????е?meta??????????????????????á?
????3.5.4. form????
???????????????????????????????????????磺<form accept-charset= "gb2312">??????????????????????????????????????
????4. ?????
??????????????????????????
????4.1. mysql?????
???????????????????????y?????????????ó?utf????unicode????utf???????洢???????????????????а???????????????????unicode???????
???????????????????mysql??????????????????default-character-set=utf8???????????????????URL??????????磺 useUnicode=true&characterEncoding=UTF-8???????????????????£????μ?sql?汾?????????????URL???????????????????????????????á?
????4.2. apache
????appache??????й????????httpd.conf?У?????AddDefaultCharset UTF-8????????????ù???????о??????????????UTF-8???ù??ù????
????????apache???е??????????????????????????????????????????á?
????4.3. linux??????
?????????????linux???????????????????????????????????????????LC_ALL??LANG????????????java URLEncode???????????????????
???????鶼?????"zh_CN.UTF-8"??
????4.4. ????
?????????????????????linux?????????????????????????磺mount/dev/hda5 /mnt/hda5/ -t ntfs -o iocharset=gb2312??
????????????????????GET????????????????request.setCharacterEncoding()???????????tomcat?????????????????????tomcat??server.xml????У????磺<Connector... URIEncoding="GBK"/>????????????????????????????????????????????????????????browser??????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11