0x00問題描述
SSM實現單個文件下載,文件名爲中文時下載到本地是一坨下劃線
0x01問題代碼:
String fineName= "book描述.avi";
HttpHeaders headers=new HttpHeaders();//設置響應頭
headers.add("Content-Disposition", "attachment;filename="+finaName);
解決辦法:
String fileName = "book描述.avi";
HttpHeaders headers=new HttpHeaders();//設置響應頭
headers.add("Content-Disposition", "attachment;filename="+new String(fileName.getBytes("utf-8"),"ISO8859-1"));