BIG5转UTF-8与UTF-8转BIG5

自定义BIG5转UTF-8

public String big52unicode(String strBIG5) 
  { 
    String strReturn=""; 
    try 
    { 
      strReturn = new String(strBIG5.getBytes("big5"), "UTF-8"); 
    } 
    catch (Exception e) 
    { 
      e.printStackTrace(); 
    } 
    return strReturn; 
  } 

  自定义UTF-8转BIG5

public String unicode2big5(String strUTF8) 
  { 
    String strReturn=""; 
    try 
    { 
      strReturn = new String(strUTF8.getBytes("UTF-8"), "big5"); 
    } 
    catch (Exception e) 
    { 
      e.printStackTrace(); 
    } 
    return strReturn; 
  } 
}
 

你可能感兴趣的:(utf-8)