When installing Moodle on a new database, if the encoding is not set correctly, the following error will occur.
It is required that you store all your data in Unicode format (UTF-8).
New installations must be performed into databases that have their default
character set as Unicode. If you are upgrading, you should perform the
UTF-8 migration process (see the Admin page).
To fix this error, you will need to set the database collation in to utf8_unicode_ci through PhpMyAdmin. The following will explain how to do this.
Changing the database collation in PhpMyAdmin
- Login to your cPanel
- Navigate to Databases > PhpMyAdmin.
- Select the database on the left that was created for the Moodle site.
- On the top right click Operations.
- On the Collation drop box, select utf8_unicode_ci.
- Click Go.
Adjust the $CFG->dboptions array in your config.php to make sure that Moodle uses the right collation when connecting to the MySQL Server:
$CFG->dboptions = array( … 'dbcollation' => 'utf8mb4_unicode_ci', … );