Changes are made at your own risk and are not guaranteed to work. Always make backups of the database and files prior to implementing hacks. Make a special backup of the file and/or template you are modifying so that you can roll back quickly.
Hacks are dangerous and can cause your site to stop working. They make later updates to ExpressionEngine more difficult; you should track your hacks for post-update re-implementation.
Most hacks are unnecessary, please review the Development Documentation for information on expanding ExpressionEngine via Modules, Extensions, and Plugins.
Hacks are never officially supported.
To switch a latin1 database to UTF-8 follow these steps:
Prerequisites: I (supersusie) was using MySQL 5, PHP 5, and EE 1.6. You can probably use earlier versions, but PHP 4.2.2 and MySQL 4.1 are probably as low as you want to go.
# Create a copy of the original latin1 (iso-8859-1) database.
# The new EE database needs to have all its tables converted to UTF-8.
I tried to use the convert script from the forums, but it didn’t work.
http://expressionengine.com/forums/viewthread/35716/
So I got a database-y friend to help. You may have another way to do this, like the one listed on this page: http://www.abcseo.com/papers/utf8-expression-engine.htm
# Make sure every template you serve has been set to use UTF-8 in the meta tag. It’s easiest if you do this using the system variable set in the General Configuration panel.
<meta http-equiv="Content-Type" content="text/html; charset={charset}" />
# Turn the site off at the General Configuration page; switch to UTF-8 at the same time
https://www.example.com/system/index.php?S=0&C=admin&M=config_mgr&P=general_cfg
# Change the connection to use the new database in the config.php file
# Change the setting of each Weblog to be set to use UTF-8
https://www.example.com/system/index.php?S=0&C=admin&M=blog_admin&P=blog_list
# Here’s the hack: The /core/db/do.mysql.php file should be edited to have this line, which ensures that the connection is UTF-8 specific:
$this->server_info = @mysql_get_server_info();
// ADD THIS to allow utf-8 character set connection between EE and MySQL
mysql_query("SET NAMES 'utf-8'");
return TRUE;
See this article for some additional changes that might be needed.
# If your Web server is serving your files with a http header that specifies is-8859-1, then you need to override that. Modify the .htaccess file with this line. (Or otherwise ensure that your Web server is serving without any http charset header)
# Change the character set to UTF-8
AddDefaultCharset utf-8
Category:HowTo
Category:Languages
Category:Tutorials
Category:Hacks
