在文件下载中设置的addheader中将filename设置为

filename=\""+ URLEncoder.encode(downloadFile.getName(), "UTF-8")+"\"

最后的形式为

response.addHeader("Content-Disposition", "attachment; filename=\""+ URLEncoder.encode(downloadFile.getName(), "UTF-8") + "\"");

将文件名转换为"%xy"的形式,xy是两位16进制的数值;而浏览器会自动的处理转换后的形式,解决下载后中文名为空的情况。

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2021-11-23
  • 2022-12-23
  • 2021-08-21
  • 2022-02-16
  • 2021-12-12
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
相关资源
相似解决方案