在Safari浏览器中,出现excel表名是中文名字乱码的情况,解决方法如下
String fileName = "营销活动数据统计表";
try {
fileName = new String(fileName.getBytes(), "iso8859-1") + ".xls";
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8");
网友评论