We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31227
    • 198 Posts
    Hello everyone,
    I am moving servers and because next year we are planning to add another language, cp1251 encoding is not convenient anymore, therefore I decided to take the opportunity and convert everything to utf8. How do I go about doing it?
    I need the whole db converted to utf8, not just alter table collation but a whole depth conversion. Are there any php scripts that can do that for me;) ?
    Or even software?
    Btw I have a script that alters the collation, however it does not convert the characters, anyway here is the script, maybe someone will find it useful – not mine, but free for sure.
    <?php
    $db = mysql_connect('localhost','myuser_mydbuser','mypassword');
    if(!$db) echo "Cannot connect to the database - incorrect details";
    mysql_select_db('myuser_mydbname'); $result=mysql_query('show tables');
    while($tables = mysql_fetch_array($result)) {
    foreach ($tables as $key => $value) {
    mysql_query("ALTER TABLE $value COLLATE utf8-general_ci");
    }}
    echo "The collation of your database has been successfully changed!";
    ?>
    
      Pure MODx sites
      Viriko.ru & Viriko.com - Multilingual and running on 1 MODx