This is a comment on Database UTF-8 conversion, posted by WikiAdmin at 13.07.2021 11:27
View source for Estonian: R6.0 Unicode Migration and cp1257 Windows Baltic
This only affects wikis that use **Estonian** (##cp1257##) as their default language. In earlier versions the installer did not offered 'cp1257 Windows Baltic' as codepage for the database. While this not affected the final output in the Wiki because the database did the conversion according the requested charset in the connection, it does now because it converts the tables in the database itself. latin1 --> utf8mb4 (wrong) cp1257 --> utf8mb4 (right) %%(info type="important") For the case you did not changed the codepage for your database, you have to change the codepage to ##'cp1257 Windows Baltic'## now for all your tables **BEFORE** you run the Unicode conversion script, else the script uses the **wrong** charset! %% action/convert_cp1257.php %%(php) <?php if (!defined('IN_WACKO')) { exit; } $prefix = $this->db->table_prefix; $charset = 'cp1257'; ######################################################## ## Convert charset for tables ## ######################################################## echo '<h3>1.1. Convert database and tables based on charset to ' . $charset . ':</h3>'; if (!isset($_POST['set_charset_tables'])) { echo $this->form_open(); echo '<input type="submit" name="set_charset_tables" value="' . $this->_t('UpdateButton') . '">'; echo $this->form_close(); } else if (isset($_POST['set_charset_tables'])) { $tables = [ 'acl', 'auth_token', 'cache', 'category', 'category_assignment', 'config', 'external_link', 'file', 'file_link', 'log', 'menu', 'page', 'page_link', 'poll', 'rating', 'referrer', 'revision', 'user', 'usergroup', 'usergroup_member', 'user_setting', 'watch', 'word', ]; $results = '<strong>' . date('H:i:s') . ' - ' . 'Table conversion started' . "\n" . '================================================</strong>' . "\n"; $results .= '<strong>' . 'Charset: ' . $charset . ':</strong>' . "\n\n"; // Database $this->db->sql_query("ALTER DATABASE {$this->db->database_database} CHARACTER SET = {$charset};"); // Tables foreach ($tables as $table) { $this->db->sql_query("ALTER TABLE " . $prefix . $table . " DEFAULT CHARACTER SET {$charset};"); $this->db->sql_query("ALTER TABLE " . $prefix . $table . " CONVERT TO CHARACTER SET {$charset};"); $results .= "\t" . '<strong>' . date('H:i:s') . ' - ' . $table."\n" . "\t" . '------------------------------------------------</strong>' . "\n"; } $results .= '<strong>' . date('H:i:s') . ' - ' . 'Tables converted.' . "\n" . '================================================</strong>' . "\n"; echo '<div class="code">' . '<pre>' . $results . '</pre>' . '</div><br>'; } %% Do not forget to remove the action ##~{{convert_cp1257}}## before you continue with with the Pre-Upgrade conversion script ##~{{admin_utf8}}##.