开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜