把 src 转为utf-8
public static String toUTF8(String str) {
if (str == null)
return null;
String retStr = str;
byte b[];
try {
b = str.getBytes("ISO8859_1"); for (int i = 0; i < b.length; i++) {
byte b1 = b[i];
if (b1 == 63)
break; // 1
else if (b1 > 0)
continue;// 2
else if (b1 < 0) { // 不可能为0,0为字符串结束符
//retStr = new String(b, "GB2312");
retStr = new String(b, "utf-8");
break;
}
}
} catch (Exception e) {
}
return retStr;
}