试试:
while{rs.next){
content=new String(rs.getString("content").getByte("iso-8859_1"),"GBK");//(或用"gb2312","utf-8","GBK")都没用

}

解决方案 »

  1.   

    content=new String(rs.getString("content").getBytes("iso-8859-1"),"GB2312");
    前提是确保插入数据库的是中文
      

  2.   

    谢谢大家,用以上的方法好像不行。问题我已经解决了。方法如下(我是从java 开发者上看到的,到现在还没明白,请大家研究研究到底是这么回事)
    import sun.io.*;public static String AsciiToChineseString(String s) { 
        char[] orig = s.toCharArray(); 
        byte[] dest = new byte[orig.length]; 
        for (int i=0;i<orig.length;i++) 
          dest[i] = (byte)(orig[i]&0xFF); 
        try { 
          ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312"); 
          return new String(toChar.convertAll(dest)); 
        } 
        catch (Exception e) { 
          System.out.println(e); 
          return s; 
        } 
      }   public static String ChineseStringToAscii(String s) { 
        try { 
          CharToByteConverter toByte =    CharToByteConverter.getConverter"gb2312"); 
          byte[] orig = toByte.convertAll(s.toCharArray()); 
          char[] dest = new char[orig.length]; 
          for (int i=0;i<orig.length;i++) 
            dest[i] = (char)(orig[i] & 0xFF); 
          return new String(dest); 
        } 
        catch (Exception e) { 
          System.out.println(e); 
          return s; 
        } 
      } 
      

  3.   

    谢谢大家,用以上的方法好像不行。问题我已经解决了。方法如下(我是从java 开发者上看到的,到现在还没明白,请大家研究研究到底是这么回事)
    import sun.io.*;public static String AsciiToChineseString(String s) { 
        char[] orig = s.toCharArray(); 
        byte[] dest = new byte[orig.length]; 
        for (int i=0;i<orig.length;i++) 
          dest[i] = (byte)(orig[i]&0xFF); 
        try { 
          ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312"); 
          return new String(toChar.convertAll(dest)); 
        } 
        catch (Exception e) { 
          System.out.println(e); 
          return s; 
        } 
      }   public static String ChineseStringToAscii(String s) { 
        try { 
          CharToByteConverter toByte =    CharToByteConverter.getConverter"gb2312"); 
          byte[] orig = toByte.convertAll(s.toCharArray()); 
          char[] dest = new char[orig.length]; 
          for (int i=0;i<orig.length;i++) 
            dest[i] = (char)(orig[i] & 0xFF); 
          return new String(dest); 
        } 
        catch (Exception e) { 
          System.out.println(e); 
          return s; 
        } 
      } 
      

  4.   

    谢谢大家,用以上的方法好像不行。问题我已经解决了。方法如下(我是从java 开发者上看到的,到现在还没明白,请大家研究研究到底是这么回事)
    import sun.io.*;public static String AsciiToChineseString(String s) { 
        char[] orig = s.toCharArray(); 
        byte[] dest = new byte[orig.length]; 
        for (int i=0;i<orig.length;i++) 
          dest[i] = (byte)(orig[i]&0xFF); 
        try { 
          ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312"); 
          return new String(toChar.convertAll(dest)); 
        } 
        catch (Exception e) { 
          System.out.println(e); 
          return s; 
        } 
      }   public static String ChineseStringToAscii(String s) { 
        try { 
          CharToByteConverter toByte =    CharToByteConverter.getConverter"gb2312"); 
          byte[] orig = toByte.convertAll(s.toCharArray()); 
          char[] dest = new char[orig.length]; 
          for (int i=0;i<orig.length;i++) 
            dest[i] = (char)(orig[i] & 0xFF); 
          return new String(dest); 
        } 
        catch (Exception e) { 
          System.out.println(e); 
          return s; 
        } 
      }