设置响应编码,将文件名称用java.net.URLEncoder.encode编码,这样就不会乱码了
java.net.URLEncoder.encode
response.setCharacterEncoding("UTF-8");
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName="+java.net.URLEncoder.encode(name,
"UTF-8"));