I'm trying to persist some data that I get from a form in a MySQL database using Doctrine2 and Symfony 2. My problem is that this data is in Greek and although the Collation of the database and the fields is utf8_general_ci it Doctrine2 doesn't store correctly this characters.
I've checked that this characters are correct in my mapping class, so I guess that the problem is my Doctrine configuration. Any ideas of what it might be?
I figure it out myself. I had to set Doctrine Dbal to utf8. For that I only needed to add the following to my config.yml:
doctrine:
dbal:
//rest of the configuration
charset: utf8
You also need the following entry in my.cnf:
collation-server = utf8_general_ci
character-set-server = utf8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With