Zend Framework 2 - doctrine: special characters problem

July 08, 2014 at 05:59
Zend Framework

All my tables and the database are set to utf8_general_ci, yet I suddenly encountered a problem with ZF2 and saving data to the database. My test-entry "höhöhöhö" was saved like this: db Google search didn't get me far, because the only hint I could find was an instruction to SET NAMES 'UTF8' in my database connection, but I was already doing that. Since I used doctrine to save my data, I added the following to my doctrine.global.php:
                    'params' => array(
                        'host' => 'localhost',
                        'port'     => '3306',
                        'dbname' => 'table_name',
                        'charset' => 'utf8' //<---- here!
And suddenly the special chars worked!

Tags: doctrine special chars umlaute ZF2

Hinterlasse einen Kommentar: