这两天在运维一个项目。项目在测试网上正常,等到部署到正式网上出现乱码问题
当时后台的代码
response.setContentLength(outData.length);
response.setHeader("Content-Disposition", "p_w_upload;filename=" + new String(fileName.getBytes(), "utf-8"));
ServletOutputStream sos = response.getOutputStream();
sos.write(outData);
最后修改为
response.setContentType("application/x-msdownload");
response.setContentLength(outData.length);
response.setHeader("Content-Disposition", "p_w_upload;filename=" + URLEncoder.encode( fileName,"utf-8"));
系统恢复正常。
转载于:https://blog.51cto.com/xiaowei1989/1613442