读取文件没有指定字符集;
使用以下的函数进行转化,在操作数据库的时候,调用这两个函数(写数据库用chineseToUnicode,读数据库用unicodeToChinese
public String UnicodeToChinese(String s){
try{
if(s==null||s.equals("");
return "";
String newStr;
newStr = new String(s.getBytes("iso8859_1"),"gbk2312");
return new String;
}
catch(Exception e){
//do something
}
}public String ChineseToUnicode(String s){
try{
if(s==null||s.equals("");
return "";
String newStr;
newStr = new String(s.getBytes("gbk2312"),"iso8859_1");
return new String;
}
catch(Exception e){
//do something
}
}