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;
}
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;
}
我有一个byte数组,编码格式是UNICODE的。我想把他转换成GB2312的数组。
然后用pFile.write(array,0, lenght);这个函数写到文件里
return new String(str.getBytes(code),toCode);
}