MySql UTF Encoding

 java.sql.SQLException: Incorrect string value: '\ xAC \ xED \ x00 \ x05sr ...' for column 'xxxx'

A column is long text in MYSQL using the utf8 charset and utf8_general_ci commands.

What's wrong?

+3
source share
5 answers

A bit late, but you may know that \ xAC \ xED \ x00 \ x05sr ... is the magic number for Java serialization. Apparently your parameter is serialized instead of being inserted as a string.

+6
source

Assuming these are hexadecimal escape codes, the text is \xAC\xED\x00\x05sr...not a valid UTF-8 string.

+2
source

Is this used when using PreparedStatements in Groovy? If so, you are using GStrings instead of plain Java strings. Check your object, make sure your parameters are what you expect.

+1
source

change the table to latin encoding or utf8mb4

0
source
ALTER TABLE your_table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

You can try this.

0
source

Source: https://habr.com/ru/post/1742190/


All Articles