public static String toChinese(String strvalue) {
     try {
       if (strvalue == null)
         return null;
       else {
         strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
         return strvalue;
       }
     }
     catch (Exception e) {
       return null;
     }
   }

解决方案 »

  1.   

    package tools;public class ts{
    public static String gbTo(String gbStr)
    {
    String str = null;
    try{
    str    = new String(gbStr.getBytes("GB2312"),"8859_1");
    }catch(Exception e){}
    return       str;
    }
    public static String toGb(String Str)
    {
    String str = null;
    try{
    str    = new String(Str.getBytes("8859_1"),"GB2312");
    }catch(Exception e){}
    return       str;
    }
    }