How to make PDO run SET NAMES utf8 each time I connect, In ZendFramework
fear my google-fu
$pdo = new PDO( 'mysql:host=mysql.example.com;dbname=example_db', "username", "password", array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
first hit ;)
Itay,
A very good question. Fortunately for you the answer is very simple:
database.params.driver_options.1002 = "SET NAMES utf8"
1002 is the value of constant PDO::MYSQL_ATTR_INIT_COMMAND
You can't use the constant in the config.ini
just put this in your config
database.params.charset = "utf8"
or after ZF 1.11 this would work to resources.db.params.charset = utf8
that is it