mysql dump cp1251 utf8 ‘ш’ ‘И’ problem solution

iconv -f utf8 -t cp1251 dump.sql | sed 's/\xD1\x3F/\xD1\x88/g;s/\xD0\x3F/\xD0\x98/g' > corrected_dump.sql

2 thoughts on “mysql dump cp1251 utf8 ‘ш’ ‘И’ problem solution

  1. Nikolay Petrov

    Thanks .
    This works even if your database is already in cp1251, just use sed as described above and redirect output through > to the new sql file.

    Reply
  2. Nikolay Petrov

    Hello again 😉
    I found an error in my .sql when i try to import the correct database file after iconv. The error is:
    ERROR 1062 (23000) at line 870: Duplicate entry ‘�����’ for key ‘user_name’
    whan can be the reason for that?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *