excel文件名是中文,然后導出的文件名是一串“-------.xls”,問題出在這里
response.setHeader("Content-disposition", "attachment; filename=“中文”.xls)
后來解決了,改為
String zhStr= "中文"; String fileName = null; try { /*根據request的locale 得出可能的編碼,中文操作系統通常是gb2312*/ fileName = new String(as.getBytes("GB2312"), "ISO_8859_1"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } zhStr=fileName; response.setHeader("Content-disposition","attachment; filename="+zhStr+".xls");;