tomcatmariadbbirt

BIRT Report having trouble with accented characters coming from database


I have some reports made on Spanish by someone. These work properly if I install the Tomcat server on Windows, however we recently switched the whole stack to Ubuntu and now I am facing this problem where all the accented characters look like this.

enter image description here

"País de Origen" should be showing México, for example. If you can see, the word País as template words do show correctly. I am querying this data from a MariaDB instance.

Any help appreciated


Solution

  • Thanks a lot for your suggestions, I managed to fix it by following my only clue which was that the template accents were rendered correctly but dynamic data wasn't.

    With this I edited the database connection URL to jdbc:mysql://db:3306/mycooldb?characterEncoding=UTF-8 and that fixed it.

    This setting I got from this article: https://balusc.omnifaces.org/2009/05/unicode-how-to-get-characters-right.html

    Usually the database's JDBC driver is smart enough to use the database and/or table specified encoding for querying and storing the data. But in worst cases you have to specify the character encoding in the connection string as well. This is true in case of MySQL JDBC driver because it does not use the database-specified encoding, but the client-specified encoding. How to configure it should already be answered in the JDBC driver documentation. In for example MySQL you can read it here:

    jdbc:mysql://localhost:3306/db_name?useUnicode=true&characterEncoding=UTF-8