在Safari瀏覽器中鞍时,出現(xiàn)excel表名是中文名字亂碼的情況,解決方法如下
String fileName = "營銷活動數據統(tǒng)計表";
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");