Set Character Encoding as UTF-8 throughout your Zend Framework App

AKA more utf-8 vs latin pain and woe.

Ok. Some of you may have read my earlier post where I thought zend form was screwing up, when in actuality is the IDE. Well the fun didn’t stop there. So to spare you the pain and anguish etc, here’s what you do.

Make sure your database is UTF-8, and any fields have utf8_general_ci
In your application.ini - resources.db.params.charset = utf8
In your application.ini - resources.view.encoding = "UTF-8"
In your layout phtml head - <meta charset='utf-8'>

We should all be smiling happy now!

Advertisements

3 thoughts on “Set Character Encoding as UTF-8 throughout your Zend Framework App

  1. Hey, MANY thanks for this – just solved a problem with field showing blank when populated from a database. The values had encoded characters, which then crashed the ‘form->populate’ call. Setting the application ini settings ensured they were decoded properly.

  2. Dude i love you!!!!! You just solved a problem that i had for about 3 months.
    Thanks. If you come to Brazil, beer is on my account. Subscribing to you page!!!!!!!!!!!!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s