user121196
user121196

Reputation: 31070

MySql UTF encoding

 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?

Upvotes: 4

Views: 3909

Answers (5)

user1276886
user1276886

Reputation:

ALTER TABLE your_table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

You can try this.

Upvotes: 0

Nathan Mall
Nathan Mall

Reputation: 11

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.

Upvotes: 1

Jakub Bochenski
Jakub Bochenski

Reputation: 3277

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.

Upvotes: 7

user666923
user666923

Reputation: 87

change your table to latin1 encoding or utf8mb4

Upvotes: 0

Mark Byers
Mark Byers

Reputation: 839154

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

Upvotes: 2

Related Questions