开发者

MySql UTF encoding

开发者 https://www.devze.com 2022-12-28 05:29 出处:网络
java.sql.SQLException: Incorrect string value: \'\\xAC\\xED\\x00\\x05sr...\' for column \'xxxx\' T开发者_如何学Gohe column is a longtext in MYSQL with utf8 charset and utf8_general_ci collation.
 java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'xxxx'

T开发者_如何学Gohe column is a longtext in MYSQL with utf8 charset and utf8_general_ci collation.

What is wrong?


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.


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


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.


change your table to latin1 encoding or utf8mb4


ALTER TABLE your_table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

You can try this.

0

精彩评论

暂无评论...
验证码 换一张
取 消