fix database wrong encoded
I have an old site that the encoding is 开发者_Go百科utf8. But the database is latin1. The problem is that all data (thousands) were recorded wrong.
Sample of a phrase engraved
verificação de erro na geração dos códigos
Is there any SQL function that transforms all records in the database for the correct coding?
Yes, that is simple :)
INSERT INTO utf8table (utf8column)
SELECT CONVERT(latin1field USING utf8) FROM latin1table;
http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html
You can also do that with PHP. You can select data, transform it with iconv() functions, and update appropriate fields. Do whaterver you are more confortable with.
精彩评论