I hope I understood that correctly. You wrote an event which does the 
conversion in both direction and fire it every time you need it?
That´s...some kind of...brilliant :)

-----Ursprüngliche Nachricht-----
Von: Christian Ebert [mailto:[email protected]] 
Gesendet: Montag, 22. Oktober 2012 10:09
An: [email protected]
Cc: Marc Tempelmeier
Betreff: AW: [fw-general] [ZF2] Set default encoding to ISO in Zend Framework 2

Hi Marc,

yesterday I again played around with this. I did not have the time to test
it thoroughly yet but it seems to work if I simply add an event listener to
doctrine which inits MySQL session with utf-8. My strategy currently is the
following:

- Database tables stay encoded using latin1
- The new ZF2 functionality uses completely utf-8
- Doctrine is initialized with utf-8:
$entityManager->getEventManager()->addEventSubscriber(new
\Doctrine\DBAL\Event\Listeners\MysqlSessionInit('utf8', 'utf8_unicode_ci'));

=> the data, especially umlauts, seem to get correctly inserted and read
from the database. Hopefully I can follow this approach not needing to write
data mappers.

Would be great to hear if this works also for you.

Would be great to hear some Database/Doctrine experts if this is a viable
and robust approach.

Best Regards
Christian



--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to