jsp的页面出现乱码的原因:是没有为其指定编码
可以通过如下语句
<%@ page contentType="text/html;charset=gb2312"%>
这是处理显示中的乱码,
然后接收的时候也要处理乱码:
用
1.
String str=request.getParameter(“girl”);
Byte B[]=str.getBytes(“ISO-8859-1”);
Str=new String(B);
或者
2,request.setCharacterEncoding("GBK");
所以,要2次处理,即显示和接收的时候都要处理.
可以通过如下语句
<%@ page contentType="text/html;charset=gb2312"%>
这是处理显示中的乱码,
然后接收的时候也要处理乱码:
用
1.
String str=request.getParameter(“girl”);
Byte B[]=str.getBytes(“ISO-8859-1”);
Str=new String(B);
或者
2,request.setCharacterEncoding("GBK");
所以,要2次处理,即显示和接收的时候都要处理.