Grails, MySQL and Encoding Problem

I recently installed MAMP (MySQL 5.5, PHP) on Mac OS for using MySQL together with Grails. Strangely, the Chinese and Japanese character input didn’t work as expected, something that I had never experienced problems with when working in Grails.

After having wasted the better part of an afternoon I finally found out that the problem occurred contrary to my initial suspicion not inside of the new Grails 1.4 release but between Grails and the MySQL database server. Adding useUnicode=true&characterEncoding=UTF8 to the connection URL did the trick, like so:

jdbc:mysql://localhost:8889/test_db?useUnicode=true&characterEncoding=UTF8

Leave a Reply

Your email address will not be published. Required fields are marked *


*