解决Java POI 导出Excel时文件名中文乱码,兼容浏览器
String agent = request.getHeader("USER-AGENT").toLowerCase();
response.setContentType("application/vnd.ms-excel");
String fileName = "文件名";
String codedFileName = java.net.URLEncoder.encode(fileName, "UTF-8");
if (agent.contains("firefox")) {
response.setCharacterEncoding("utf-8");
response.setHeader("content-disposition", "attachment;filename=" + new String(fileName.getBytes(), "ISO8859-1") + ".xls" );
} else {
response.setHeader("content-disposition", "attachment;filename=" + codedFileName + ".xls");
}