用内码转换String(str.getByte("8859-1"),"gb2312")

解决方案 »

  1.   


    使用下面函数转换检体为繁体:public String togb(String iso)
        {
            String gb=null;        if (iso != null)
            {        try
            {     gb=new String(iso.getBytes("ISO-8859-1"),"big5");         }
            catch (Exception e)
            {     gb=null;        }        }        return gb;  }
    整个网站转换也可用下面代码:
    <meta content="text/html; charset=big5" http-equiv=content-type>
    加在页面头的<head></head>中
      

  2.   

    public static String big5ToUnicode(String s)
        {
      try
          {
      return new String(s.getBytes("ISO8859_1"), "Big5");
          }
    catch (UnsupportedEncodingException uee)
          {
      return s;
          }
        }    public static String unicodeToBig5(String s)
    {
    try
          {
      return new String(s.getBytes("Big5"), "ISO8859_1");
          }
    catch (UnsupportedEncodingException uee)
          {
      return s;
          }
        }
      

  3.   

    你是要改变简繁体还是转换编码为big5?都不好整。