本人在Jsp页面中,输入汉字,数据库却存储些乱码,进而在JSP页面上查询数据库上的信息,刚才输入的汉字信息则以“???“显示。如果之前在数据库中存储汉字,JSP中可以正常显示。请问是什么原因?
本人把自己的配置环境说一下。MyEclipse 6.0,MySQL Server 5.1,Tomcat 5.5,jdk1.6.0_14。
mysql的my.ini文件中
default-character-set=gbk,
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=gbk
JSP中添加了<%@page contentType="text/html;charset=GBK"%>
<%@page pageEncoding="GBK"%>
<%
request.setCharacterEncoding("GBK");
%>
在url中也加了useUnicode=true&characterEncoding=GBK
结果还是这样。谁能麻烦帮我解释解释原因,以及问题出在哪。我有代码,如果想要给我发邮件[email protected]
本人把自己的配置环境说一下。MyEclipse 6.0,MySQL Server 5.1,Tomcat 5.5,jdk1.6.0_14。
mysql的my.ini文件中
default-character-set=gbk,
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=gbk
JSP中添加了<%@page contentType="text/html;charset=GBK"%>
<%@page pageEncoding="GBK"%>
<%
request.setCharacterEncoding("GBK");
%>
在url中也加了useUnicode=true&characterEncoding=GBK
结果还是这样。谁能麻烦帮我解释解释原因,以及问题出在哪。我有代码,如果想要给我发邮件[email protected]
解决方案 »
- JasperException: Cannot find any information on property
- 软件运行过程中有时候出现All threads are busy, waiting. Please increase maxThreads....
- lomboz3.3_@hibernate_注释提示出现不了(其余的注释都行)_在线等
- jsp中如何设置滚动条自下而上滚动?
- EncodingFilter中为何只初始化却在最后没有注销?
- 关于Egothor的问题
- 回复数怎么办?
- pooledconnection 如何使用?
- 怎样看出我当前机器所设置的CLASSPATH是什么?
- 在JSP中调用Bean函数出错的问题
- 高分求解Spring中bean的singleton问题
- 提问!在struts2中如何写下载的代码???
回复内容不短~~
mysql utf-8
项目工程编码 utf-8
每个jsp页面编码 utf-8
必要的将服务器编码改成 utf-8
最后统一加个过滤器,将编码格式过滤成UTF-8,这样应该不会出现乱码问题了
response.setcharacterset="utf-8"
谢谢大家!