sendRedirect下载文件名乱码

sendRedirect下载链接,浏览器中的文件名乱码问题:

// 文件名中文乱码问题
fileURL = new String(fileURL.getBytes("UTF-8"),"ISO8859-1");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
// 重定向请求下载
response.sendRedirect(fileURL);
分享到:
原文地址:https://www.cnblogs.com/enshrineZither/p/3080636.html