websphere下载的中文名乱码,而用tomcat没这问题!

String recommendedName =new String(file.getBytes(), “ISO8859_1”);                               
         response.reset();
         response.setContentType(“application/vnd.ms-excel;charset=gb2312”);                                  
                                                          
         response.setHeader("Pragma", "No-cache");                                   
         response.setHeader("Cache-Control", "no-cache");                         
         response.setDateHeader("Expires", 0);                                       
        
         response.setHeader("Content-Disposition","attachment; filename="+ recommendedName +"\"");                                                                       
  

求高人指点,急?


慕娘9325324
浏览 749回答 2
2回答

一只斗牛犬

charset=gb2312”把这个设置默认,抓到的页面是什么编码会根据抓到页面的编码而改变,这样灵活一般就不会出现乱码了     

有只小跳蛙

编码的问题,抓包分析下服务器以什么编码返回的数据。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java