首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

jsp 导出成CSV文件,中文乱码有关问题

2014-06-07 
jsp 导出成CSV文件,中文乱码问题!格式是UTF-8,用editplus打開正常,但是excel打開就是亂碼了!!怎么解決?Jav

jsp 导出成CSV文件,中文乱码问题!
格式是UTF-8,
用editplus打開正常,但是excel打開就是亂碼了!!
怎么解決?

Java code
os  = response.getOutputStream();            String title = "發送編號,時間,標題,接收號碼,訊息編號,接收時間,接收狀態"+"\r\n";            os.write(title.getBytes("UTF-8"));            QueryBean qb = (QueryBean) request            .getAttribute(GlobalConstNaming.QUERY_BEAN_NAME);            ResultBean resultBean = null;            resultBean=statReportMag.thrdinfo(qb,jobid,date);            List result = (List)resultBean.getTotalResult();            for(int i=0;i<result.size();i++)            {                StatSendthrdbean bean = (StatSendthrdbean)result.get(i);                String s = bean.getJobid();                s = s + ",";                s = s + bean.getDate();                s = s + ",";                s = s + (bean.getContent()==null?" ":bean.getContent());                s = s + ",";                s = s + (bean.getRecvmobile()==null? " " : bean.getRecvmobile());                s = s + ",";                s = s + (bean.getMsgid()==null ? " " : bean.getMsgid());                s = s + ",";                s = s + (bean.getRecvdate()==null? " " : bean.getRecvdate());                s = s + ",";                s = s + (bean.getStatus()==null ? " " : bean.getStatus());                s = s + "\r\n";                                os.write(s.getBytes("UTF-8"));                                                }


鐧奸
热点排行