首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > 其他服务器 >

websphere上载的中文名乱码,而用tomcat没这有关问题

2013-01-02 
websphere下载的中文名乱码,而用tomcat没这问题!直接贴代码:String recommendedName new String(file.ge

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


下载中文名乱码,求高人指点,急?

------解决方案--------------------


 response.setHeader("Content-Disposition","attachment; filename=" + URLEncoder.encode(recommendedName,"UTF-8")+ """);      //兄弟,最好改成utf-8                                                                  

热点排行