public static String unicorde2GB(String str){
try{
String  temp_p=str;  
byte[]  temp_t=temp_p.getBytes("ISO8859-1");
String  temp=new  String(temp_t);  
return  temp;  
}catch(Exception  e){}  
return null;  
}

解决方案 »

  1.   

    String gbStr = new String(unicodeStr.getBytes("ISO-8859-1"),"GB2312");
      

  2.   

    不好用啊,,朋友们 我这么跟你们说把:
    我有一个byte数组,编码格式是UNICODE的。我想把他转换成GB2312的数组。
    然后用pFile.write(array,0, lenght);这个函数写到文件里
      

  3.   

    如果你的操作系统是中文的WRITE会自动转成gbk的
      

  4.   

    public String convertStr(String str,String code,String toCode) throws UnsupportedEncodingException{
    return new String(str.getBytes(code),toCode);
    }