1.用可视化工具创建数据库是,默认字符集设为UTF-8
2.到MySQL安装根目录下修改
'default-character-set=latinl'为'default-character-set=utf8'[注意:不是utf-8]
'default-character-server=latinl'为'default-character-server=utf8'
重启Mysql服务
3.MyEclipse创建工程时,将默认的GBK编码改为'UTF-8'
Window->General->Workspace->Text file encoding
4.在Servlet文件中添加
request.setCharacterEncoding(“utf-8”);