Wednesday, April 28, 2010

CakePHP and Umlauts (utf-8)

I spent the last couple of weeks writing PHP. Not my favorite language, but it does get the job done. I won't bitch about PHP here, since that would be snobbery.

What eases the pain a lot is the CakePHP framework. Except, I couldn't get Umlauts to work. Umlauts are special characters, like a, o and u, but with two dots on them: ä, ö, ü.

I found the solution on this page: http://www.missingfeatures.com/2008/10/23/using-utf8-in-your-cakephp-app/

Not only must you tell your browser that you are using UTF-8, but you must also tell the database connection to use utf-8. Check the database.php file in your app/config directory and add 'encoding' => 'utf8' to the end of the database configuration.

No comments:

Post a Comment