日期:2014-05-18  浏览次数:20561 次

用jxl读excel中文乱码,从iso8859-1到gb2312,gbk,utf-8转换均无效,在线等...
如题
jdk版本:j2sdk1.4.2_12;
操作过程:本地上传excel到服务器,之后,读excel部分字段到数据库,结果,非中文正常,中文乱码。
部分代码:Cell   cell   =   rs.getCell(j,i);
  String   s1=cell.getContents();
                    s1中文乱码;
                    将s1用以下方式转换,乱码;
                    String   s2=new   String(s1.getBytes( "ISO8859_1 "));
String   s2=new   String(s1.getBytes( "gb2312 "));
String   s2=new   String(s1.getBytes( "utf-8 "));
String   s2=new   String(s1.getBytes( "gbk "));
以上做法我是想看看目前的编码,失败;
之后进行转换,从iso8859-1到   gb2312等,互相转换,还是乱码!!!!
请高人指点,谢谢....

------解决方案--------------------
request.setCharacterEncoding( "GBK ");//这样应该可以。。。
Cell cell = rs.getCell(j,i);
String s1=cell.getContents();
System.out.prinltn(s1);