解决IE浏览器下载文件名乱码额问题
//下载的文件名为fileName
String fileName = "登录登出日志统计" + DateUtils.yyyyMMddHHmmss() + ".csv";
response.reset();
//获取客户端浏览器和操作系统信息
String userAgent = request.getHeader("User-Agent");
//针对IE或者以IE为内核的浏览器:
if (userAgent.contains("MSIE")||userAgent.contains("Trident")) {
response.setHeader("Content-Disposition", "attachment;filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
} else {
//非IE浏览器的处理:
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("UTF-8"), "iso8859-1"));
}