I have non-ASCII characters in keys in my database that are supposed to be UTF-8 (utf8mb4
) encoded. And they sort of are, but not entirely:
From Java via JDBC (mysql:mysql-connector-java:8.0.21
), a:
SELECT * FROM whatever WHERE id="Dümmer";
produces the right row. However, the value of the id
column is returned as:
Dümmer
Here is what I know:
- in the
mysql
console, the value is printed correctly. - the column has been created with:
`id` varchar(511) CHARACTER SET utf8mb4 COLLATE utf8mb4_nopad_bin NOT NULL,
- the
com.mysql.cj.jdbc.MysqlDataSource
has anull
character encoding. I have tried.setCharacterEncoding( "UTF-8" )
but that does not seem to make a difference.
Where else should I look? This is Linux, Mariadb 10.5.5, running client and server on the same machine.