字符编码格式不一样,java的常见问题,有很多文章,你再找找。

解决方案 »

  1.   

    不是呀,我的这个问题已结贴谢谢! 
    楼上的JCP兄弟,我又遇一新问题:SQLException和Exception有什么区别?
    我的程序这样的:   private Vector getNextRow( ResultSet rs,
                                  ResultSetMetaData rsmd )
           throws SQLException
       {
          Vector currentRow = new Vector();
          for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
         //currentRow.addElement( rs.getString( i ) );     currentRow.addElement(new String(rs.getString( i ).getBytes("ISO8859_1"),"GBK"));   /
          //返回一条记录
          return currentRow;
       }
    报错如下------------
    "JavaOracle.java": Error #: 360 : unreported exception: java.io.UnsupportedEncodingException; must be caught or declared to be thrown at line 144, column 31
      

  2.   

    System.out.println(new String(rset.getString(1).getBytes("ISO8859_1"),"GBK"));入库前先输出看看是不是乱码入库后在看看是不是乱码!方法很笨但是有效:)
      

  3.   

    try{
    System.out.println(new String(rset.getString(1).getBytes("8858_1"),"GBK"));
    }catch(UnsipportedEncodingException ex){
    throw new SQLException("中文问题:)");
    }
    Oracle的中文字符集默认GBK
    这样也许还是还是会有中文问题
    不知道这样会不会好:
    System.out.println(new String(rset.getString(1).getBytes("GBK")));