wake

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

          此錯誤讓我及其郁悶:搞了一整天帶一加班,終于解決了,但具體為什么就不知道了...

          問題描述:當(dāng)初同事的開發(fā)環(huán)境為:jsp+struts+hibernate+tomcat5.0+jdk1.4.1,后來因為機器頻繁死機,所以想換成WEBSPHERE平臺...接著就出現(xiàn)了以下錯誤:

          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,部分頁面經(jīng)過以上改動還是不行,我換成
          <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" %> 就可以了。

          問題總算解決,但部分原因不明,亂七八糟的改了那些東西,等有時間再仔細研究研究...

          posted on 2006-11-08 16:45 wake 閱讀(5908) 評論(2)  編輯  收藏 所屬分類: 個人原創(chuàng)

          Feedback

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

          你的jsp的編碼其實既不是UTF-8,也不是GBK,所以導(dǎo)致錯誤  回復(fù)  更多評論   

          # 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.  回復(fù)  更多評論   


          主站蜘蛛池模板: 文成县| 中山市| 古交市| 泰宁县| 浦江县| 湾仔区| 阜平县| 青铜峡市| 兰西县| 年辖:市辖区| 清远市| 淳化县| 沙雅县| 吉木乃县| 光泽县| 忻州市| 共和县| 曲靖市| 白城市| 山东| 大姚县| 金溪县| 寿光市| 河西区| 长沙县| 土默特右旗| 包头市| 孟津县| 乌兰浩特市| 柞水县| 光山县| 长顺县| 彭水| 城步| 交城县| 澳门| 眉山市| 河北省| 万荣县| 阿勒泰市| 通州区|