360浏览器下载含有中文的文件名与其它浏览器的区别

360浏览器下载还是有点小问题!不过不影响下载   名称那里是乱码,下载后的名字从:http://localhost/webs/download.action?path=uploadfile/ppt/5.中经网统计数据库O.ppt 下的5.中经网统计数据库O.ppt;

那位朋友有更好地办法将名称也不是乱码且能下载的,请联系我哟!!! email:weipeng@ssreader.cn    共同进步!!!

String str = ServletActionContext.getRequest().getHeader("USER-AGENT").toLowerCase();
        if (str.indexOf("360se") > -1) {
            path = new String(path.getBytes("iso-8859-1"), "gb2312");
        } else {
            path = new String(path.getBytes("iso-8859-1"), "utf8");
        }
        fullname = path.substring(path.lastIndexOf("/") + 1);
        
        File dst = new File(ServletActionContext.getServletContext().getRealPath("/"));
        String dstin = dst.toString();
        String down = dstin + "\\" + path;
        java.io.File file = new File(down);
        if (!file.exists()) {
            java.io.File f = new File(down.substring(0, down.lastIndexOf("/")));
            if (!f.exists()) {
                f.mkdirs();
            }
            file.createNewFile();
        }
        
        FileInputStream in = null;
        try {
            in = new FileInputStream(down);
            
        } catch (Exception e) {
            System.out.println("Error!");
            e.printStackTrace();
        }
        return in;
    }

posted @ 2012-07-05 11:51  狼里格朗  阅读(820)  评论(0编辑  收藏  举报