1、idea中用mybatis查询数据库中文乱码
在查询IP21实时数据库过程中,通过odbc-jdbc驱动取数,试过很多编码格式都是乱码
while (rs.next() && index < 1000) {
for (int i = 1; i <= columnCount; i++) {
String result = rs.getString(i);
try {
result = new String(result.getBytes(), "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.print(autoBlank(result, 40));
}
System.out.println();
index++;
}
最后通过调整ide的编码格式解决