<%@ page pageEncoding="gb2312" contentType="text/html; charset=gb2312"%>
<%
//只针对 post 中文数据起作用
//request.setCharacterEncoding("gb2312");
String strUserName, strUserPass;
strUserName = request.getParameter("userName");
strUserPass = request.getParameter("userPass");
//1. 无论对 post 或 get 的中文都起作用
strUserName = new String(strUserName.getBytes("8859_1"),"gb2312");
//2. 无论对 post 或 get 的中文都起作用
//strUserName = new String(strUserName.getBytes("iso-8859-1"),"gb2312");
//3. 无论对 post 或 get 的中文都起作用
//byte b[] = strUserName.getBytes("iso-8859-1");
//strUserName = new String(b);
out.print("您输入的姓名是:" + strUserName);
out.print("<br/>");
out.print("您输入的密码是:" + strUserPass);
%>