When using use the MariaDB Connector/J with UTF-8 data, some characters are not properly rendered, and the collation from the database is not respected. Apparently, the MariaDB jdbc driver doesn't fully support character encodings and collation with utf-8- The problem was observed when trying to use latin1_spanish_ci collation in driver version 2.5.4 (mariadb-java-client-2.5.4.jar).
At the time of writing, the issue still seems to be unresolved; see MariaDB issue CONJ-417 Support characterEncoding and collation in jdbc and Setting Character Sets and Collations in the MariaDB knowledge base for more information.
As a workaround, you may be able to use the MySQL jdbc driver, not the MariaDB driver (even though the database itself is MariaDB), and set the following driver properties:
- characterEncoding utf-8
- connectionCollation latin1_spanish_ci
Depending on the version of the database and driver, you may experience other problems when running MariaDB using a MySQL driver; we recommend using the MariaDB driver when connecting to a MariaDB server.