ODBC-JDBC Bridge Windows-1251 (Cyrillic) character encoding -
i've got dbase file window 1251 encoding. i've made odbc datasource file , access jdbc-odbc bridge java following code:
printstream ps = new printstream(system.out, true, "utf-8"); system.out.println("test: Русский язык"); class.forname("sun.jdbc.odbc.jdbcodbcdriver"); properties properties = new properties(); properties.put("charset", "windows-1251"); connection conn = drivermanager.getconnection( "jdbc:odbc:test_ds",properties); statement statement = conn.createstatement(); string sql = "select * table"; resultset resultset = statement.executequery(sql); while (resultset.next()) { system.out.println(resultset.getstring("desc")); }
character encoding ok test println (2nd line), encoding data dbase incorrect.
i'm able open dbf file libreoffice same encoding correct.
is there chance set encoding correctly?
is possible set connection encoding in connection string?
edit: after further investigation, think problem odbc related. tried open defined datasource excel , encoding wrong. (i had no chance set encoding either odbc connection, neither excel connection)
this works me on cyrillic characters:
properties.put("charset", "cp1251");
Comments
Post a Comment