Home  >  Article  >  Database  >  MyEclipse+Mysql乱码解决方案!

MyEclipse+Mysql乱码解决方案!

WBOY
WBOYOriginal
2016-06-07 15:34:45970browse

1、Mysql安装时或按装后选择服务器配置时即MySQL Server Instance Config Wizard在选择编码时,默认是latin1选择成gbk,之后再重建数据库、表等。 2、为JSP加编码过滤器。 public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg

1、Mysql安装时或按装后选择服务器配置时即MySQL Server Instance Config Wizard在选择编码时,默认是latin1选择成gbk,之后再重建数据库、表等。

2、为JSP加编码过滤器。

 public void doFilter(ServletRequest arg0, ServletResponse arg1,
   FilterChain arg2) throws IOException, ServletException {
  arg0.setCharacterEncoding("GBK");
  arg2.doFilter(arg0, arg1);
 }等。

3、JSP页中。

其他的基本不用变动,即可正常在JSP页中插入与读取汉字,在MYSQL客户端也可正常插入或读取显示汉字了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn