I just came across this problem on a Japanese site (Moodle 1.7 set up with
Fantastico).
A temporary workaround is :
- open "lib/dmlib.php" with a text editor
- locate the following lines
if ($CFG->unicodedb) {
$db->Execute("SET NAMES 'utf8'");
}
- replace the above lines with
if ($CFG->unicodedb) {
// $db->Execute("SET NAMES 'utf8'");
}
- save the modified file
However, the better workaround is to convert the database to unicode. I think this is more complicated that just setting the CHARSET or COLLOCATION using
phpMyAdmin, because you need to convert all the data that has already been input into the database using the "latin1_swedish" encoding.
To make sure the data in the database is correctly converted to unicode, you should run the Moodle unicode migration script:
- backup your Moodle database (e.g. create a new DB using cPanel and use phpMyAdmin to copy the current DB to the new one)
- open your "config.php" file and remove the following line if you see it:
$CFG->unicodedb = 1;
- using phpMyAdmin, locate the "config" table. If it contains a "unicodedb" record, set the value to "0"
- login to Moodle and set Site -> Debugging to the maximum level, i.e. DEVELOPER
- access the following URL on your site:
admin/utfdbmigrate.php
- run the migration script, wait patiently while it runs, and verify it completes successfully
If all goes well, the database is now converted to unicode and you can copy and paste characters from ANY language into Moodle.
good luck!
Gordon