因为文件名为中文,导出时会有乱码问题
原代码:
String fileName = "文件名.doc"; response.setHeader("Content-Disposition", "attachment;filename=".concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
修改为:
String uncod=URLDecoder.decode("文件名.doc","UTF-8"); String fileName = new String(uncod.getBytes("UTF-8"), "iso-8859-1"); response.setHeader("Content-Disposition", "attachment;filename=".concat(String.valueOf(fileName)));
导出中文名成功!