0

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"

acambeiro
  • 33
  • 3

2 Answers2

1

řů 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

Community
  • 1
  • 1
Rick James
  • 135,179
  • 13
  • 127
  • 222
  • The problem was that the schema was created with latin1 and the tables were inheriting the encoding. Even when i changed the schema encoding, i had to change the tables encoding too or regenerate the database. – acambeiro Jan 20 '17 at 11:02
  • 1
    A suitable `ALTER` can possible recover the data, but need more details to be sure not to do the wrong alter. – Rick James Jan 20 '17 at 17:44
  • Still in dev, losing that was not an issue, but thanks for the tip anyway – acambeiro Jan 23 '17 at 16:58
0

Probably has some special character, and the UTF-8 encode that you are forcing may cause some error.

This ASCII string has the following text:

String:

jedna dva tři kachna dům a kachní maso

ASCII:

'jedna dva t\xc5\x99i kachna d\xc5\xafm a kachn\xc3\xad maso'