Posted By

jdbartlett on 03/06/09


Tagged

mysql character utf8 convert encoding latin1


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

jamesming
vali29
michaellehmkuhl
jschilling
jamiepeloquin
virendrakryadav


Correcting wrong character encoding in MySQL data


 / Published in: MySQL
 

When you forget to "SET NAMES utf8", you'll probably end up with a bunch of latin1 data in your utf8 column. This query fixes that, CONVERTing the existing data to its correct collation.

  1. UPDATE table SET COLUMN=CONVERT(CONVERT(CONVERT(COLUMN USING latin1) USING BINARY) USING utf8);

Report this snippet  

You need to login to post a comment.