D
D
Denis Lysenko2012-12-19 13:16:19
MySQL
Denis Lysenko, 2012-12-19 13:16:19

Convert base to UTF8 partially

Good day!

There is a MySQL database, several tables. Previously, the cron script parsed some data and wrote it to the database as is - in cp1251. Later, the script was redesigned, now it overtakes the text in utf-8 before writing. Actually, now the database is in such a state that half of the database is in utf-8 and is displayed normally, and the old records are in cp1251.

Can anyone tell me how to convert old records from cp1251 to utf-8?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alukardd, 2012-12-19
@Alukardd

Well, well, apparently in 3 stages:
1 - upload data up to a certain point, for example, by date. You can use the same mysqldump, and then cut off part of the table file;
2 - convert to utf-8, the same iconv;
3 - update the table. Either by writing via SQL UPDATE, or merge back into the table file and drive it entirely into the database. The 2nd option is possible only if this table does not change constantly, i.e. you can freeze it for a minute.

F
Fyodor, 2012-12-19
@Richard_Ferlow

Maybe try Sypex Dumper? after export, import by specifying the encoding and checking the checkbox - encoding correction? I'm not sure, but I treated the wrong encodings like this

K
KEKSOV, 2012-12-19
@KEKSOV

In one project, it was necessary to solve a similar problem, the expression helped:
ALTER TABLE CONVERT TO CHARACTER SET utf8;
I can’t say anything about special characters, I haven’t met them ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question