写入的时候要转换字符,具体用哪个我也忘记了。。public static String getStr(String str){
try{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String unicode=new String(temp_t,"GBK");
return unicode;
}
catch(Exception e){
System.out.println(e);
return "";
}
}
public static String getStr1(String str){
try{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("GBK");
String unicode=new String(temp_t,"ISO8859-1");
return unicode;
}
catch(Exception e){
System.out.println(e);
return "";
}
}格式:
out.write(getStr("测试文字"));
或者
out.write(getStr1("测试文字"));自己测试一下吧。
try{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String unicode=new String(temp_t,"GBK");
return unicode;
}
catch(Exception e){
System.out.println(e);
return "";
}
}
public static String getStr1(String str){
try{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("GBK");
String unicode=new String(temp_t,"ISO8859-1");
return unicode;
}
catch(Exception e){
System.out.println(e);
return "";
}
}格式:
out.write(getStr("测试文字"));
或者
out.write(getStr1("测试文字"));自己测试一下吧。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货