问题
java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'xxxx'
The column is a longtext in MYSQL with utf8 charset and utf8_general_ci collation.
What is wrong?
回答1:
It's a bit late, but you might want to know that \xAC\xED\x00\x05sr... is a magic number for Java serialization. Apparently your parameter is being serialized instead of being pasted as a string.
回答2:
Assuming that those are hexadecimal escape codes, the text \xAC\xED\x00\x05sr...
is not a valid UTF-8 string.
回答3:
Is this while using PreparedStatements in Groovy? If so, you're using GStrings instead of plain Java Strings. Check your object yo make sure your parameters are what you expect.
回答4:
change your table to latin1 encoding or utf8mb4
回答5:
ALTER TABLE your_table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
You can try this.
来源:https://stackoverflow.com/questions/2687164/mysql-utf-encoding