UTF-8

UTF-8

by Rishi VG -
Number of replies: 12

I have some problem of Moodle 1.7 UTF-8. How can i solve it.

Attachment Unicode_missing.JPG
Average of ratings: -
In reply to Rishi VG

Re: UTF-8

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
Like it says on the errormessage: you should visit the admin page and hit the migration button. This process put some load on your server and can take a while. As with any upgrade process or altering database process, it is highly recommended to make a backup first and read the documentation on migration process (http://docs.moodle.org/en/Upgrading_to_Moodle_1.6)
In reply to koen roggemans

Re: UTF-8

by Harald H -
i can't find the migration button, right now i have moodle 1.6.3 installed and i would like to do the database migration befor upgrading to 1.7
tia

In reply to Harald H

Re: UTF-8

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
The migration button should be on the admin page. It disappears once the migration is done.
A newly installed 1.6 doesn't need migration - only when you upgrade from a pre-1.6 or if your database is not configured according to the installation instructions (should be utf-8)
In reply to koen roggemans

Re: UTF-8

by Alex Jacoby -
I've got the same problem -- the Environment page tells me to migrate to UTF-8 by using the button on the Admin page, but there's no such button on the Admin page.

I'm trying to upgrade from 1.7 to 1.8. It appears that my tables are currently using latin1 (myPhpAdmin says the table collation is latin1_swedish_ci).

I saw another site recommending making the change via phpMyAdmin (or the CL), but that wouldn't be my first choice.

Also, I tried accessing the /admin/utfdbmigrate.php page directly, but it says "Error - migration already performed".

Thanks for any suggestions,
Alex
In reply to Alex Jacoby

Re: UTF-8

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hello,

you then have to manually change (via PhpMyAdmin) the table collation...

I had done that some time ago, when migrating to a new version, and all was OK after that smile
Séverin
Average of ratings: Useful (1)
In reply to Séverin Terrier

Re: UTF-8

by Alex Jacoby -
OK, thanks. I changed the default collation for the database to UTF-8-general, and the Environment page now seems happy. However, the existing tables all still have the old latin1_swedish collation. I need to change the collation of the existing tables too, right? I mean, it can't be *that* easy!

Best,
Alex
In reply to Alex Jacoby

Re: UTF-8

by Nicolas Martignoni -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

For changing the collation of existing tables, see here. Don't forget to insert the UTF-8-general (instead of the latin1 mentioned in the example).

Good luck!

In reply to Nicolas Martignoni

Re: UTF-8

by Alex Jacoby -
Thanks again for the advice. I'm unsure about the post you linked to though. It suggests changing the charset and collation for all existing tables, but after I do that, the collation for individual columns in the old tables is still latin1_swedish_ci. Is that a problem?

Here's what the post suggests (and yes, I replaced "latin1" with "utf8"):

<blockquote>
I agree with Georg Richter that for a large database as is the case of the initial poster LordJohnny, the better steps are, given a bit more knowledge,
(1) SHOW TABLES
this delivers a plain list of all tables in the data base
(2) create a file with many ALTER TABLE xxx DEFAULT CHARSET latin1 COLLATE latin1_mylanguage_ci;
(3) run that file.
</blockquote>

Cheers,
Alex
In reply to Alex Jacoby

Re: UTF-8

by Nicolas Martignoni -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Sorry, I was maybe unclear. For the point 2, use

ALTER TABLE xxx DEFAULT CHARSET utf8 COLLATE utf8_unicode_ci;

Good Luck!

In reply to Nicolas Martignoni

Re: UTF-8

by Alex Jacoby -
Thanks for the quick response. No, you were clear, that's exactly what I did smile

However, after running the script, though the tables' new charset and collation are utf8 (and utf8_unicode_ci), the old columns in the tables still say they're using latin1_swedish_ci collation. It appears the collation is controlled on a column by column basis, and even if a table has a default charset/collation defined, its columns can use something else.

Or am I misunderstanding this? The upgrade seems to have worked. I haven't tried using any extended characters yet though.

All your help is much appreciated,
Alex
In reply to Alex Jacoby

Re: UTF-8

by Nicolas Martignoni -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

I was indeed wrong and one needs to make the change for every varchar/char type column. I found this php script that could be useful to try (after backing up your DB). Hope it helps: I didn't have to use it for my DBs.

Nicolas