tomcat, myeclipse, mysql 设立encoding=UTF-8

tomcat, myeclipse, mysql 设置encoding=UTF-8

     我把myeclipse 和mysql 的编码方式都改成了UTF-8 ,可是插入数据时还是出现中文乱码,于是知道了还要修改tomcat,修改方法如下:

     在tomcat的安装目录下,找到conf,再打开server.xml,在<Connector port=”8080″ protocol=”HTTP/1.1″   connectionTimeout=”20000″     redirectPort=”8443″ />中添加URIEncoding=”UTF-8″,变成<Connector port=”8080″ protocol=”HTTP/1.1″    connectionTimeout=”20000″     redirectPort=”8443″ URIEncoding=”UTF-8″/>就可以啦!!

  另外,说一下myeclipse里如何修改编码方式,windows->Preferences->general->Content Types ->Text,在Text 下选择对应的文件类型再改页码编码为UTF-8,点击Update,ok.

(在项目根节点上按快捷键Alt+Enter,弹出窗口,在Resource中选择Other为UTF-8是一样的效果)

   mysql中修改,是在安装的时候,在选择编码方式时,选择Maunual Selected Default Character Set/Coollation,在Character Set下拉菜单中选择UTF-8就可以啦!!

tomcat, myeclipse, mysql 设立encoding=UTF-8

相关文章:

你感兴趣的文章:

标签云: