帮帮忙呀,是不是代码太长了,其实很简单的,
主要是ChineseStringToAscii和AsciiToChineseString两个方法我不知道对不对.

解决方案 »

  1.   

    我来给你指导指导吧!
    String AsciiToChineseString(String s)
    {
    if(s == null)
    return null;
    byte[] dest ; 
    String chineseStr = s;
    try { 
    dest = s.getBytes('8859_1');
    chineseStr = new String(dest,"gb2312");

    catch (Exception e) { return s; } 
    return chineseStr;
    } String ChineseStringToAscii(String s) 
    {
    if(s == null) return null;
    byte[] byte ;
    String asciStr = s;
    try { 
    byte= s.getBytes("gb2312");
    asciStr = new String(byte,"8859_1");}catch(Exception e){

    return asciStr;
    }
      

  2.   

    谢谢你.
    我用了你的方法,可存进去的还是??,这是怎么回事.
    存的时候用的是ChineseStringToAscii(sql).