概述
当前位置:我的异常网» 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
文章评论
最后
以上就是清脆刺猬为你收集整理的linux excel 中文乱码,jxl linux 下中文乱码救命!的全部内容,希望文章能够帮你解决linux excel 中文乱码,jxl linux 下中文乱码救命!所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复