i have
Class.forName("org.sqlite.JDBC");
Properties properties = new Properties();
properties.setProperty("characterEncoding", "UTF-8");
properties.setProperty("encoding", "\"UTF-8\"");
Connection conn = DriverManager.getConnection("jdbc:sqlite:cities.db", properties);
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select * from cities;");+
while (rs.next()) {
byte[] bytes = rs.getBytes("country");
String country = new String(bytes, "utf-8");
System.out.println(country);
}
rs.close();
conn.close();
My output shows � for characters like ä,ö,ü.
if i run sqlite3 file from command line, and query the table from there, the characters are fine...
"pragma encoding;" shows utf-8...
if i debug, the bytes array has "-127" at the place of "ü"...
how to fix that? what could cause that problem?
Aucun commentaire:
Enregistrer un commentaire