http文件现在文件名带()会出现乱码

2022-07-30 12:16:35
使用URLEncoder.encode("(1)班")下载的文件名会变成%281%29班格式
response.setHeader("Content-Disposition", "attachment; filename="+Encodes.urlEncode(fileName));


解决办法:

response.setHeader("Content-Disposition", "attachment; filename="+new String(fileName.getBytes("gbk"), "ISO8859-1"))


  • 作者:cz596738622
  • 原文链接:https://blog.csdn.net/cz596738622/article/details/79855543
    更新时间:2022-07-30 12:16:35