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

文章评论

参与评论 您还未登录,请先 登录 后发表或查看评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:1024 设计师:我叫白小胖 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值