【发布时间】:2014-12-03 06:45:08
【问题描述】:
我在数据库中创建了一个包含泰卢固语数据的表。当我尝试在 java 中使用 eclipse 检索泰卢固语数据时,我得到了矩形框。
代码:
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sloka?useUnicode=yes&characterEncoding=UTF-8", "root", "");
st = con.createStatement();
} catch (Exception e) {
System.out.print("error:" + e);
}
public void getData() {
try {
String query = "select * from eesavyasa ";
rs = st.executeQuery(query);
System.out.print("records from database");
while (rs.next()) {
String name1 = new String(rs.getBytes("firstcolumn"), "UTF-8");
String name2 = new String(rs.getBytes("secondcolumn"), "UTF-8");
String name3 = new String(rs.getBytes("thirdcolumn"), "UTF-8");
String name4 = new String(rs.getBytes("fourthcolumn"), "UTF-8");
System.out.println(name1);
System.out.println(name2);
System.out.println(name3);
System.out.println(name4);
}
} catch (Exception ex) {
System.out.print(ex);
}
}
我们对 db、table 使用了整理 utf-8,但我们在矩形框中得到了输出 请尽快回复
【问题讨论】:
-
你的字体不支持 unicode 点...
-
你能准确定义吗
-
您要显示的字符在您使用的字体中不可用,请更改字体...