Talk:Converting your MySQL database to UTF8

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Converting your MySQL database to UTF8.

Hi,

Could you help me how to convert to UTF8,im using Phpmyadmin in cPanel.

Hope somebody could help me.

Thanks, Danica

Converting latin1 to utf8

I had the same problem with converting DB from latin1 to utf8. And that how I did it:

1. Export your DB to somedb.sql on your pc. 2. Open dump in MS Word: 2.1. It will ask you in wich charset to convert(open) - show utf-8 3. Find and replace all words latin1 to utf8 4. Save file as somedb.txt 5. Change extension txt to sql 6. Drop the old DB on server 7. Upload(import) new dump to server. 8. Check your site. Done.

Converting latin1 to utf8

The existing sed replacement command resulted in charset errors on import (against an incorrectly-restored 1.9 database); the following sed commands resolved the issue completely:

sed 's/latin1_general_ci/utf8_unicode_ci/' <dump.sql | sed 's/CHARSET=latin1/CHARSET=utf8/' | sed 's/SET latin1/SET utf8/' >dump-fixed.sql