?????????????????????????
????????my.ini??????

????[mysql]
????default-character-set=utf8
????[client]
????default-character-set=utf8
????[mysqld]
????default-character-set=utf8

??????????????????????磩

DROP   TABLE   IF   EXISTS   `Company`;
CREATE TABLE   IF   NOT   EXISTS   `Company`
(
`Cname`   VARCHAR(10)   NOT   NULL??
`Caddr`   VARCHAR(100)??
`Ctel`     VARCHAR(16)
)ENGINE=InnoDB   DEFAULT   CHARSET=UTF8;


?????????????

?????????jsp???????

contentType="text/html;charset=gb2312"


???????????
????????mysql??????????mysql???????????????????????????????utf-8?????????????

//???mysql-jdbc????
Class.forName("com.mysql.jdbc.Driver").newInstance();
//?????????
Connection sqlCon = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test?user=root&password=1&useUnicode=true&characterEncoding=utf-8" );

???????????
??????????????????????????????????????????????????????????

??????????????£?

String name = rst.getString("name");
name= new String(name.getBytes("ISO-8859-1")??"utf-8");


???????????????????String name =new String(rst.getString("name").getBytes("ISO-8859-1")??"utf-8"));????rst??????resultset??ISO-8859-1?mysql???????????????????????ISO-8859-1?????????gb2312??????????????????????????????????????????????????????????????????

??????????
???????????????Щ????????????????????????????????????????????С??????????£???????????????????????????????

????????????????????????mysql??????????????????????????C:winntmy.ini ?е? [mysqld] ???????У?

????default-character-set=utf-8  ???????mysql??

????????壺
??????tomcat conf ?????web.xml????????

<filter>
<filter-name>UTFEncoding</filter-name>
<filter-class>com.founder.chenph.Util.EncodingFilter_UTF8
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UTFEncoding</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>UTFEncoding</filter-name>