把你项目改成和数据库一致的

解决方案 »

  1.   

    谢谢
    试过了 还是不行 后来找了个将ascii转化为中文字符串的函数可以用了
    还没细看
    贴上来先
    public static String AsciiToChineseString ( String s ) { if ( s == null ) return 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; } }
      

  2.   

    所有的乱码都是由编码不一致造成的。