jsp写入access数据乱码

request.setCharacterEncoding("gb2312");Stringname=request.getParameter("name");name=n... request.setCharacterEncoding("gb2312");
String name =request.getParameter("name");
name=new String(name.getBytes(), "GB2312");
<%@page contentType="text/html"%>
<%@page pageEncoding="gb2312"%>

这类东西我都试过了,不行

读取过之后直接out.println就是乱码
但是直接该mdb文件,用jsp读出来是中文

请大侠指教
展开
 我来答
x358011055
2010-05-29 · TA获得超过253个赞
知道小有建树答主
回答量:234
采纳率:55%
帮助的人:162万
展开全部
这里:name=new String(name.getBytes(), "GB2312");
应该是name=new String(name.getBytes("iso-8859-1"), "GB2312");

另外,你使用name=new String(name.getBytes("iso-8859-1"), "GB2312");了,那么request.setCharacterEncoding("gb2312");就可以省掉不要了。

你先试试,不行的话,在问题里面补充。
百度网友270ac68
2010-05-27 · TA获得超过174个赞
知道小有建树答主
回答量:234
采纳率:0%
帮助的人:63.1万
展开全部
见一个拦截器实现接口Filter,需要在web.xml配置,public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException,IOException{
request.setCharacterEncoding(code);
response.setContentType("text/html;charset=utf-8");
chain.doFilter(request, response);
}

就是类似这样就行
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式