Search code examples
jdbcplayframeworkebeanutf8mb4

Play framework JDBC ebean mysql exception with characters řů but accepts áõ


Trying to save models and i get a:

java.sql.SQLException: Incorrect string value: ...

Saving a text like "jedna dva tři kachna dům a kachní maso"

I'm using default.url="jdbc:mysql://[url]/[database]?characterEncoding=UTF-8"


Solution

  • řů have no encoding in latin1; áõ do. That suggests that CHARACTER SET latin1 is involved somewhere. Let's see SHOW CREATE TABLE.

    C599, etc, are valid utf8 encodings for the corresponding characters.

    ? occurs when the destination character set cannot represent the character. Again, this points to the column/table being latin1, when it should be utf8 (or utf8mb4).

    More discussion, and for debugging similar situations: Trouble with utf8 characters; what I see is not what I stored