日期:2014-05-16 浏览次数:20325 次
public static final String bm="GBK"; //全局定义,以适应系统其他部分 PrintWriter out = null; BufferedReader in = null; out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(echoClient.getOutputStream(),bm)),true); in=new BufferedReader(new InputStreamReader(echoClient.getInputStream(),bm)); out.println(new String(str.getBytes(bm),bm)); out.flush(); in.readLine();
request.setCharacterEncoding("GBK"); String website=request.getParameter("website"); String websiteName=request.getParameter("websiteName"); websiteName=new String(websiteName.getBytes("ISO-8859-1"),"GBK");//转码否则出现中文乱码