中文乱码
zz_d 2010-12-08 08:36:35 数据库配置:
[ mysql] default-character-set=gb2312
[ mysqld] default-character-set=gb2312
数据表: create table table_name(.....)default character set gb2312;
过滤器:
public void doFilter(.......)
{
request.setCharacterEncoding("gb2312");
response.setCharacterEncoding("gb2312");
chain.doFilter(request,response);
}
在web.xml中:
<filter> ......<filter-mapping>......
页面:
<%@ page contentType="text/html;charset=gb2312" %>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
问题:从JSP页面添加到数据库中的内容乱码,但直接从mysql命令行插入的中文可以正常返回JSP页面.
求解分析.