天天看点

Eclipse 中的乱码问题

1、重新安装eclipse,未设置编码问题,导致乱码

2、编码设置可以在新建项目时设置,也可以在workspace中设置

3、servlet中未设置编码格式,导致的乱码

request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");           

4、jdbc连接中的乱码问题

public String JDBC_URL = "jdbc:mysql://localhost:3306/mi_shop_store?characterEncoding=UTF-8";           

此时需要加上true&

public String JDBC_URL = "jdbc:mysql://localhost:3306/mi_shop_store?true&characterEncoding=UTF-8";           

继续阅读