lxw
2022-08-17 8a2c8422a6676b7111ad0841ec5fee2ba0c8b7c2
软件下载
1个文件已修改
10 ■■■■ 已修改文件
src/main/java/com/whyc/service/ProductSoftwareService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductSoftwareService.java
@@ -55,8 +55,8 @@
        ProductSoftware software=mapper.selectOne(wrapper);
        try {
            // 转码防止乱码
            resp.addHeader("Content-Disposition", "attachment;filename="
                    + new String(softwareName.getBytes("UTF-8"), "ISO8859-1"));
            //resp.addHeader("Content-Disposition", "attachment;filename=" + new String(softwareName.getBytes("UTF-8"), "ISO8859-1"));
            resp.setHeader("Content-Disposition", "attachment;filename* = UTF-8''" +  new String(softwareName.getBytes("UTF-8"), "ISO8859-1"));
            OutputStream out = resp.getOutputStream();
            FileInputStream in = new FileInputStream(fileDirName+File.separator+software.getSoftwareUrl());
            int len=0;
@@ -79,4 +79,10 @@
        String terminalIp=req.getRemoteAddr();
        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
    }
    public static void main(String[] args) throws UnsupportedEncodingException {
        String softwareName="散装件.zip";
        //ISO8859-1 UTF-8
        System.out.println(new String(softwareName.getBytes("GBK"), "UTF-8"));
    }
}