b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Installation / Upgrade
  3. Upgrade
  4. Upgrading your database to UTF-8

Upgrading your database to UTF-8

Upgrading your database to UTF-8

Nowadays, using UTF-8 as character encoding is almost a must. If you want to know what we are talking about here, please read this: UTF-8 Encoding and if you need to go a little deeper, please try with this: Unicode.

From b2evolution version 5, we recommend the usage of UTF-8 for all users.

Automatic conversion

Starting with version 5.1

b2evolution has its own tool to convert all of your database to UTF-8. All you have to do is follow these steps:

  1. Go to your install home (i.e. http://mydomain.com/install).
  2. Select the radio button Upgrade your DB to UTF-8.
  3. Click the button "GO!".

This will perform the conversion of each table in your b2evolution database one by one. (Note the tool will convert all tables in the b2evolution database).

Back-office maintenance tool

Starting with version 5.2, a maintenance tool is available in the back-office. It lets you to perform an automatic upgrade of your database encoding anytime you want.

Upgrading your database to UTF-8

Manual UTF-8 conversion

For sites below version 5.1, there is a manual option to perform the same conversion. In order to make this job easier, you could follow this instructions (before of that, please make a copy of your entire database):

  1. Create a new file named ut8_upgrade.php and paste this code:

<?php
    require_once dirname(__FILE__).'/conf/_config.php';
    require_once $inc_path.'_main.inc.php';
 
    echo '<h2>'.T_('Upgrading all tables in b2evolution MySQL database to UTF-8...').'</h2>';
    evo_flush();
 
    $db_tables = $DB->get_col( 'SHOW TABLES FROM `'.$db_config['name'].'` LIKE "'.$tableprefix.'%"' );
    foreach( $db_tables as $table )
    {
        echo "Converting $table...<br />\n";
        evo_flush();
        $DB->query( 'ALTER TABLE `'.$table.'`
            DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci,
            CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci' );
    }
 
    echo "Changing default charset of DB...<br />\n";
    evo_flush();
    $DB->query( 'ALTER DATABASE `'.$db_config['name'].'` CHARACTER SET utf8 COLLATE utf8_general_ci' );
    ?>
    <p><?php echo T_('Upgrading done!')?></p>
  1. Put it in /blogs/.
  2. Run the script on php command line or directly at your web browser: http://yourdomain.com/blogs/ut8_upgrade.php
  3. Delete the file /blogs/utf8_upgrade.php (optional - there is no need to use it again)

This will change your database charset to UTF-8 and the collations to utf8_general_ci.

Tags: faq
Created by mgsolipa • Last edit by fplanque on 2020-06-09 00:25 • •

No feedback yet

On this page

  • Automatic conversion
  • Starting with version 5.1
  • Back-office maintenance tool
  • Manual UTF-8 conversion

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
    • New Installation
    • Upgrade
      • Manual Upgrade Procedure
      • Auto-Upgrade Procedure
      • After Installation / Upgrade
      • Automated Install / Upgrade
      • Upgrading Evoskins
      • Unexpected SQL Error during upgrade
      • Upgrading your database to UTF-8
      • Instructions for specific versions
    • Configuration files
    • Advanced Setup
    • Migrating from Another System
    • Moving your b2evolution Site
    • FAQ & Troubleshooting (Installation / Upgrade)
    • Assumed User Skills
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
Blog software

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque