If you search for the title of this tip you will found lot of hits. Actually, my last search returned 6.6 millions of hits! Apparently lot of people are having with - or has fears on this subject. When I first published this tip, back in 2005, there was no such amount of answers/references, and I think, that this real flood of sites about this potential issue is not because lot of people would having problems, but because more and more people are getting into building interactive sites.

So, do You have problems?

If you use Joomla, essentially the answer would be probably a straight NO. Versions of MySQL lower than 4.1 do not have build in utf-8 support. However, Joomla! 1.5 has made provisions for backward compatibility and is able to use utf-8 on older databases. Let the installer take care of all settings and there is no need to make any changes to the database (character-set, collation or any other). But, remember - if you want to be prepared not only for past, but for the future too, you should seek web hosting with LATEST MySQL and full UTF-8 support. You will need both for top level security, compatibility and full multi-language capability.

What if you have a Joomla site which was developed on older Joomla versions or on hosts without UTF-8 support?

Upgrade them, and convert the database to full UTF-8. Both can be tricky, here's a simple SQL script to convert your existing database! Use at your own risk, and backup first!!!

mysqldump --user=username --password=password --default-character-set=latin1 --skip-set-charset dbname > dump.sql
sed -r 's/latin1/utf8/g' dump.sql > dump_utf.sql
mysql --user=username --password=password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql --user=username --password=password --default-character-set=utf8 dbname < dump_utf.sql

You might be able to do this from inside phpMyAdmin too, but the above is built to be used from command prompt.

0
0
0
s2sdefault
Category: Configuration tricks