if (request.getHeader("User-Agent").toUpperCase().indexOf("FIREFOX") > 0) {
fileName = new String(fileName.getBytes("UTF-8"), "ISO8859-1");
} else if (request.getHeader("User-Agent").toUpperCase().indexOf("CHROME") > 0) {
fileName = new String(fileName.getBytes("UTF-8"), "ISO8859-1");
} else {
fileName = Encodes.urlEncode(fileName);
}
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/octet-stream; charset=utf-8");
标签:中文,浏览器,String,文件名,Agent,fileName,User,new,getBytes From: https://blog.51cto.com/u_16242566/7536855