wake

sun.io.MalformedInputException at sun.io.ByteToCharGB18030.convert

此错误让我及其郁闷:搞了一整天带一加班,终于解决了,但具体为什么就不知道了...

问题描述:当初同事的开发环境为:jsp+struts+hibernate+tomcat5.0+jdk1.4.1,后来因为机器频繁死机,所以想换成WEBSPHERE平台...接着就出现了以下错误:

sun.io.MalformedInputException at sun.io.ByteToCharGB18030.convert(ByteToCharGB18030.java(Compiled Code)) at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java(Inlined Compiled Code)) at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java(Compiled Code)) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java(Compiled Code)) at java.io.InputStreamReader.read

省略....

解决方法:
1,其中有些页面是JS的问题,去掉就可以了,但为什么???

< script language = " JavaScript " >  
<!--  
var flag
= false
function DrawImage(ImgD)

var image
= new  Image(); 
image.src
= ImgD.src; 
if (image.width > 0   &&  image.height > 0 )
flag
= true
if (image.width / image.height >=   100 / 80 )
if (image.width > 100 )
ImgD.width
= 100
ImgD.height
= (image.height * 80 ) / image.width; 
}
else
ImgD.width
= image.width; 
ImgD.height
= image.height; 
}
 
ImgD.alt
= image.width + " ?+image.height; 
}
 
else
if (image.height > 80 )
ImgD.height
= 80
ImgD.width
= (image.width * 80 ) / image.height; 
}
else
ImgD.width
= image.width; 
ImgD.height
= image.height; 
}
 
ImgD.alt
= image.width + " ?+image.height; 
}
 
}
 
}
 
// --> 
</ script >

2,原来的部分JSP页面是这样
<%@ page language="java" pageEncoding="UTF-8"%>
改为:
<%@ page language="java" pageEncoding="GBK">  就可以了。这个原因是因为其中包含页面定义的编码为GBK。
3,部分页面经过以上改动还是不行,我换成
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" %> 就可以了。

问题总算解决,但部分原因不明,乱七八糟的改了那些东西,等有时间再仔细研究研究...

posted on 2006-11-08 16:45 wake 阅读(5872) 评论(2)  编辑  收藏 所属分类: 个人原创

Feedback

# re: sun.io.MalformedInputException at sun.io.ByteToCharGB18030.convert 2008-06-06 10:14 lubberings

你的jsp的编码其实既不是UTF-8,也不是GBK,所以导致错误  回复  更多评论   

# re: sun.io.MalformedInputException at sun.io.ByteToCharGB18030.convert 2008-08-20 16:24 jk

pls check the encoding of your page. it should be uft8 also.  回复  更多评论   



只有注册用户登录后才能发表评论。


网站导航: