解决Jsp中文乱码3招:
1) request.setCharacterEncoding("gb2312");//解决表单传递乱码
2) //从数据库中取出后给name转码
name = new String (name.getBytes("iso-8859-1","gb2312");
3) //存入数据库前给name转码
name = new String(name.getBytes("gb2312","iso-8859-1");
解决Jsp中文乱码3招:
1) request.setCharacterEncoding("gb2312");//解决表单传递乱码
2) //从数据库中取出后给name转码
name = new String (name.getBytes("iso-8859-1","gb2312");
3) //存入数据库前给name转码
name = new String(name.getBytes("gb2312","iso-8859-1");