首页 新闻 会员 周边 捐助

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

0
悬赏园豆:50 [已解决问题] 解决于 2012-12-10 09:56

       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 +"\"");                                                                       
         response.resetBuffer();                                                     
         PrintWriter sos
= response.getWriter();
         sos.print(sb.toString());
         sos.flush();                                                                
         sos.close();

 

求高人指点,急?

haoxin的主页 haoxin | 初学一级 | 园豆:61
提问于:2012-09-18 10:43
< >
分享
最佳答案
1

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

收获园豆:50
jason2013 | 小虾三级 |园豆:1998 | 2012-09-18 16:10

o

haoxin | 园豆:61 (初学一级) | 2012-11-27 17:11
其他回答(2)
0

编码的问题,抓包分析下服务器以什么编码返回的数据。

Launcher | 园豆:45050 (高人七级) | 2012-09-18 11:36
0

大陆默认的编码是gb2312,只要把编码改成gb2312就行了。。。

浮夸灬yun | 园豆:204 (菜鸟二级) | 2012-09-18 22:28
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册