在weblogic下 poi3.8 导出excel数据,中文会成乱码
但在tomcat下是正常的,各位求解,谢谢!

解决方案 »

  1.   

     response.setContentType("application/msexcel;charset=UTF-8");
      

  2.   

    这是我昨天刚解决的问题,看对你有没有帮助 try {
               // fileName = new String(fileName.getBytes("UTF-8"), "UTF-8");
               //if (request.getHeader("User-Agent").toLowerCase().indexOf("firefox") > 0)          fileName = new String(fileName.getBytes("UTF-8"), "ISO8859-1");//firefox浏览器
            
    //         else 
    //
    //             if (request.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0)
    //
    //             fileName = URLEncoder.encode(fileName, "UTF-8");//IE浏览器 
            } catch (UnsupportedEncodingException e) {
                // should no happen
            }
         System.out.println(fileName);
            response.reset();
            response.setContentType("application/msexcel;charset=UTF-8");
            response.setHeader("Content-disposition", "attachment;filename= " + fileName);
        }
      

  3.   

                            String downloadName = "表名.xls";
    downloadName = new String(downloadName.getBytes(), "ISO8859-1");
    response.setHeader("Content-disposition",   "attachment;filename=" + downloadName);
    response.setContentType("application/x-download");

    ServletOutputStream servletOutputStream = response.getOutputStream();
    wb.write(servletOutputStream);
    servletOutputStream.flush();
    servletOutputStream.close();