文件下载文件名乱码解决

if(request.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0){
    response.setHeader("Content-disposition", "attachment; filename="
            + URLEncoder.encode(product.getRealName1(), "UTF-8"));
    }else{
        response.setHeader("Content-disposition", "attachment; filename="
            + new String(product.getRealName1().getBytes("utf-8"), "ISO8859-1"));
}

 

posted @ 2014-07-01 20:41  箜篌  阅读(314)  评论(0编辑  收藏  举报