[Java]response.setHeader()下載中文文件名問題

//設置文件名
            String filename = "家庭網絡運營參展.xls";
            //設置文件輸出頭
            //response.setHeader("Content-Disposition", "attachment;filename="+URLEncoder.encode(filename, "utf-8")); 

或者
            response.setHeader("Content-Disposition", "attachment;filename="+new String(filename.getBytes(), "iso8859-1")); 
            ServletOutputStream fos=response.getOutputStream();            
            workbook.write(fos);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章