We're building a Symfony2 app that's using an Oracle database. All the data in the DB is encoded as WE8ISO8859P15 (iso-8859-1), and all the website is encoded as utf-8.
Is there any way to convert all the data received from the database to utf8, and all the data sent to the DB to iso-8859-1, instead of convert the website to iso8859-1? Maybe using a Doctrine event subscriber? If so, which events should I intercept?
You are able to set encoding of connection to your
oracle
db inconfig.yml
. In your case you should set connection encoding toUTF-8
andOracle
should handle all conversion betweenUTF-8
(website) andiso-8859-1
(db) encoding. So putting this configuration in your config.yml should be enough:I solve a similar problem with a MSSQL instance for convert from utf8 to latin1 and viceversa. I do the following step:
config.yml
too)This his the code:
DBAL CUSTOM TYPE
BUNDLE INITIALISATION
AN EXAMPLE MAPPED ENTITY
Hope this help and hoping you find a better solutions too!!!