How to convert a window-1251 (russian cyrillic) My

2020-07-18 10:40发布

问题:

I have a databse of a russsian website and it's encoded in windows-1251. Another words, the letters look like this from phpmyadmin: Âûõîäÿùàÿ â Ëîíäîíå ãàçåòà íà àðàáñêîì ÿçûêå «Àëü-Õàéÿò» ñîîáùèëà,. Another words illegible charahcters. In order for the content to display properly this code must be added in php.

header("Content-Type: text/html; charset=windows-1251");

I would like to migrate this site an opensource software such as joomla or wordpress without hiccups.

So, in order to do that I need to convert these funny looking charachters to utf-8 which will look like this even in phpmyadmin:

Выходящая в Лондоне газета на арабском языке «Аль-Хайят» сообщила,

Any help would be much apprecciated.

回答1:

Dump the .sql and use iconv ( linux program ).

iconv -f utf-8 -t latin1 < in.sql | iconv -f cp1251 -t utf-8 > out.sql

I did this earlier this year, How can I convert Cyrillic stored as LATIN1 ( sql ) to true UTF8 Cyrillic with iconv?

If you dont know how to get iconv, and dont have any sensitive information stored in the sql, I can do it for you and send it back to you.