Announcement Announcement Module
Collapse
No announcement yet.
Converting database from Latin1 to UTF8 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Converting database from Latin1 to UTF8

    Take database dump with mysqldump -u $USERNAME -p $DATABASENAME > databasedump.sql
    Then we use VIM to replace charset:

    vim databasedump.sql
    :%s/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8/
    :wq

    Create a new empty database in cPanel

    In phpMyAdmin under OPERATIONS change the COLLATION to “utf8-unicode-ci”
    Import the database to the new DB

    mysql --default-character-set=utf8 -p -u $USERNAME $NEWDB < databasedump.sql

    You should now have the old unchanged database; and a new database in utf8. Connect the website to the new db to test. If you get diamond symbols for special characters, e.g. £ signs; then try to force mysql connection in utf8 in the site's configuration file via:

    $mysql_charset="utf8";
Tag Cloud Tag Cloud Module
Collapse
Working...
X