Greg
Greg

Reputation: 7393

How to fix Incorrect string value when trying to convert from Latin1 to UTF8 error in mysql?

Some of my mysql database tables have been accidentally created as latin1 instead of utf8. I am now trying to fix the issue by changing the columns to their binary type then converting them to utf8 then changing them back to their original type. The problem is I am getting the following error when I try to do this:

ERROR 1366 (HY000) at line 524: Incorrect string value: '\xB4s whi...' for column 'sName' at row 73

How can I keep this from happening and convert my columns/tables to utf8?

Upvotes: 1

Views: 1186

Answers (1)

Jim Garrison
Jim Garrison

Reputation: 86774

\xB4 is the "acute accent" character in the Latin1 codepage, and must be re-encoded as a 2-byte character in UTF-8. What you want to do is alter the encoding WITHOUT changing to binary first. This will let the server re-encode the characters correctly.

Upvotes: 2

Related Questions