编码

javaweb编码中文编码乱码

    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

//        response.setContentType("text/html");
        request.setCharacterEncoding("UTF-8");
        String s = request.getParameter("name");
        System.out.println("s22 is " + new String(s.getBytes("iso-8859-1"),"UTF-8"));
        
//        InputStream in = request.getInputStream();
//        if(in != null) {
//            System.out.println("流不是空的。");
//            this.writeInputStreamToFile(in);
//             System.out.println("server time is " + new Date());
//        } else {
//            System.out.println("流是空的。");
//        }
原文地址:https://www.cnblogs.com/beaconSky/p/5591962.html