Encoding TableView data in JavaFX

I have a Maven JavaFX project in Eclipse and Firebird Database with UTF-8 table encoding (data in tables in Russian). When I try to start it from Eclipse using the command jfx:run, it was successful, and in TableView I see that all the data is correct.

enter image description here

But, when I try to create my own installer with the command jfx:nativeand install the result package, all the data in TableViews is the wrong encoding (search on the Internet prompt that requires converting data from UTF-8 to WINDOWS-1251).

enter image description here

Code to populate data from the database:

private class GetClientListTask extends Task<ObservableList<Client>> {
        @Override
        protected ObservableList<Client> call() throws Exception {
            try (Connection connection = DriverManager.getConnection(App.DB_CONNECTION_STRING, App.DB_USERNAME, App.DB_PASSWORD)) {
                com.zvpblog.KomstarService.model.jooq.tables.Client t = com.zvpblog.KomstarService.model.jooq.tables.Client.CLIENT;
                DSL.using(connection).
                selectFrom(t).
                orderBy(t.CLIENTID.desc()).
                fetch().
                map(rs -> new Client(rs.getClientid(), DateTimeUtils.convertToLocalDate(rs.getRegdate()), rs.getLname(), rs.getFname(), rs.getMname(), rs.getGender(), DateTimeUtils.convertToLocalDate(rs.getBirthdate()), rs.getAddress(), rs.getPhone())).
                forEach(c -> clients.add(c));
                clientTableViewData = FXCollections.observableArrayList(clients);
                return clientTableViewData;             
            } catch (SQLException e) {
                LOGGER.error(e);
                return null;
            }       
        }
    }

Why is the encoding correct in startup mode but incorrect in the native package?

+4
1

charSet encoding UTF8 .

...
Properties connectionProperties = new Properties();
...
connectionProperties.put("charSet", "UTF8");
connectionProperties.put("encoding", "UTF8");
...
Connection connection = DriverManager.getConnection(App.DB_CONNECTION_STRING, App.connectionProperties)
...
+1

Source: https://habr.com/ru/post/1622592/


All Articles