linux excel 中文乱码,jxl linux 下中文乱码救命!

当前位置:我的异常网» Java Web开发 » jxl linux 下中文乱码救命!

jxl linux 下中文乱码救命!

www.myexceptions.net  网友分享于:2013-01-07  浏览:79次

jxl linux 下中文乱码大虾救命!!!

excel文件数据导入oracle数据库,在window下发布是正常的,

resin,red   hand,环境,将本地文件上传至下面路径:

/adcweb/resin-2.1.17/webapps/temp/temp_excel/0706021701160367

读文件内容,resin报了下面的错

Warning:     URL   ?愀?????砀?愀??攀?????????   is   malformed.     Trying   a   file

Warning:     URL   ?愀?????砀?愀??攀?????????   is   malformed.     Trying   a   file

Warning:     URL   ?愀?????砀?愀??攀?????????   is   malformed.     Trying   a   file

Warning:     URL   ?愀?????砀?愀??攀?????????   is   malformed.     Trying   a   file

Warning:     URL   ?愀?????砀?愀??攀?????????   is   malformed.     Trying   a   file

Warning:     URL   ?愀?????砀?愀??攀?????????   is   malformed.     Trying   a   file

Warning:     URL   ?愀?????砀?愀??攀?????????   is   malformed.     Trying   a   file

下面是从文件中读出了后打印出来的结果:

-------------------strc0j   ==   a

-------------------strc1j   ==   ?

-------------------AAA-strc1j   ==   ?

-------------------BBB-strc1j   ==   ?

-------------------CCC-strc1j   ==   ?

-------------------DDD-strc1j   ==   ?

-------------------EEE-strc1j   ==   ???

-------------------FFF-strc1j   ==   ?

其中?部分在excel文件中对应的全部是汉字,

部分编码如下:

WorkbookSettings   workbookSettings=new   WorkbookSettings();

workbookSettings.setEncoding( "GB2312 ");   //关键代码,解决中文乱码,却没有预想的结果

Workbook   rwb   =   Workbook.getWorkbook(fileStream,workbookSettings);

……

……

……

……

int   intRows   =   rs.getRows();

for   (int   j   =   1;   j   <   intRows;   j++)   {

//从第一行(不读第0行表头)开始读

Cell   c00   =   rs.getCell(0,   j);   //名称

String   strc0j   =   c00.getContents();

…………

…………

System.out.println( "-------------------strc0j   ==   "   +   strc0j);

*********************************************************************

急!急!急!请大虾帮忙解决

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

自己先顶一下

补充我也作了java中文转换:

System.out.println( "strc1j = " + strc1j);

System.out.println(strc1j.getBytes());//2

System.out.println(strc1j.getBytes( "GB2312 "));//3

System.out.println(strc1j.getBytes( "ISO8859_1 "));//4

System.out.println(new String(strc1j.getBytes()));//5

System.out.println(new String(strc1j.getBytes(), "GB2312 "));//6

System.out.println(new String(strc1j.getBytes(), "ISO8859_1 "));//7

System.out.println(new String(strc1j.getBytes( "GB2312 ")));//8

System.out.println(new String(strc1j.getBytes( "GB2312 "), "GB2312 "));//9

System.out.println(new String(strc1j.getBytes( "GB2312 "), "ISO8859_1 "));//10

System.out.println(new String(strc1j.getBytes( "ISO8859_1 ")));//11

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值