在通过response导出文件数据的时候,不论是txt 还是Excel ,如果想让其文件名称为中文,解决方案:
response.setCharacterEncoding("UTF-8");
response.setContentType("application/txt");//“application/vnd.ms-excel”
response.setHeader("Content-disposition","attachment; filename="+new String(filename.getBytes("UTF-8"),"iso8859-1"));
txt excel 导出 文件名称为中文,避免乱码的解决方案,布布扣,bubuko.com
时间: 2024-08-05 11:18:19