2010-12-14

utf-8 on LAMP

If you manage LAMP applications you will run into character encoding issues soon or later.
You better stick to utf-8 at all layers: database, webserver, webframework.

While working with coppermine photo galery, after upgrading the framework, sometimes i get
badly encoded character. The DB is ok as the old and the new versions are running parallel and
the old delivers i18n characters just fine. the same apache is serving them so the last possibility
is to check the webframework. Which is unfortunately php, and I don't even know the syntax of it.

So here is a small reminder what should be changed:


function cpg_db_connect()
{
...
mysql_query('SET NAMES "utf8"', $result);
return $result;
}


this function is in include/functions.inc.php for coppermine.

No comments:

Post a Comment