Java won't write UTF8 characters in MySQL through a JNDI datasource <p>I have configured JNDI to access a MySQL database with the UTF-8 server charset. My JNDI URL in Tomcat's context file is <code>jdbc:mysql://127.0.0.1:3306/my_db?useUnicode=true&amp;amp;characterEncoding=UTF-8"</code> The database server, the database and its table are all set to utf-8 using the instructions in this site.</p> <p>By debugging the JDBC connection it appears to use UTF-8. However an e grave character is written in the database as 0x C3 83 C2 A8. Clearly, the UTF-8 string for e grave, which is 0x C3 A8 has been misinterpreted by the server as Latin1 and 0xC3 in Latin-1 is 0xC3 83 in UTF-8, and similarly 0xA8 in Latin-1 is 0xC2 A8 in UTF-8.</p> <p>If the database is properly configured as per <a href="http://stackoverflow.com/questions/21092007/why-java-strings-are-not-saved-as-utf-8-in-mysql">Why java strings are not saved as UTF-8 in MYSQL?</a> why is the server converting the input UTF-8 string from the driver into Latin-1 and then back into UTF-8 (the encoding for the database and table I am using).</p>