java文件下载不显示中文文件名

来源:互联网 发布:服务器80端口被占用 编辑:程序博客网 时间:2024/05/16 15:30

https://zhidao.baidu.com/question/1111932467425249099.html

我正在做一个javaWeb程序,涉及到文件下载,文件名是中文的,下载的时候不像是中文文件名,通过转码String name = new String(fileName1.getBytes(“UTF-8”),”ISO8859-1”);在qq浏览器和360上能显示但是到ie就爆乱码,客户还非要用 ie有没有大神可以帮帮忙

//下载response.setContentType("application/x-msdownload");String filename = "测试.zip";String iso_filename = SysParameter.parseGBK(filename);response.setHeader("Content-Disposition",        "attachment;filename=" + iso_filename);ServletOutputStream op = response.getOutputStream();op.write(ab);op.flush();op.close();SysParameter.parseGBK   方法:// 将GBK字符转化为ISO码public static String parseGBK(String sIn) {    if (sIn == null || sIn.equals(""))        return sIn;    try {        return new String(sIn.getBytes("GBK"), "ISO-8859-1");    } catch (UnsupportedEncodingException usex) {        return sIn;    }}