Answer the question
In order to leave comments, you need to log in
How to solve the problem with encoding in a java project when it is in utf, and the data is in win1251?
The problem appears only if you run the project in linux (ubutu, netbeans, if it matters).
The firebird database is launched in windows, if the project is also launched in windows, then the data from the database is displayed "correctly", if in linux, then - "crazy".
In the jdbc settings "everywhere" is utf8 (changing the settings to win1251 does not affect the result), the data in the win1251 database.
If the application in netbeans (with the same settings) is launched in windows, everything is correct.
Condition:
You cannot change the encoding in the database.
Answer the question
In order to leave comments, you need to log in
jdbc.databaseurl=jdbc:firebirdsql:127.0.0.1/0000:D:/base/base.fdb?encoding=utf8&useUnicode=true&characterEncoding=utf8
127.0.0.1 - ip сервера
0000 - порт
D:/base/base.fdb - путь до базы(сервер на windows)
Is it still relevant or not..
For normal display of data from Firebird, I use Properties for connection parameters
String conString = "jdbc:firebirdsql:192.168.0.5:bsklad";
...
paramConnection = new Properties();
paramConnection.setProperty("user", "beginner");
paramConnection.setProperty("password", "mayby");
paramConnection.setProperty("encoding", "WIN1251");
...
Class.forName("org.firebirdsql.jdbc.FBDriver");
connection = DriverManager.getConnection(conString, paramConnection);
I would look into the Locale settings on startup on Windows and on Linux.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question