Symfony2 Charset for queries parameters

character-encoding, configuration, query-builder, symfony

Solution

Found solution: To set "SET NAMES utf8" I changed my doctrine config

doctrine:
    dbal:
          driver:   %database_driver%
          host:     %database_host%
          port:     %database_port%
          dbname:   %database_name%
          user:     %database_user%
          password: %database_password%
          charset:  UTF8
          options:
             1002:  "SET NAMES 'UTF8'"

It works fine now.

Problem

I have a project in Symfony2 which works good at my localhost, but after moving it to external server problem has started. - I don't see any results names from database which contains polish characters - In Profiler i checked queries: - 'Parameters' section has correct charset - 'runnable query' has the same parameters but with bad charset for example: `(...) WHERE ((((c1_.name LIKE '%Å�%') OR (c3_.name LIKE '%Å�%') OR (..)` `Parameters: ['%ś%', '%ś%', (...)]` All database tables has charset = utf8_unicode_ci. In config.yml i set ``` doctrine: dbal: charset: UTF8 ``` Setting framework charset doesn't work. /config.php test says: ``` RECOMMENDATIONS: 1. Install and enable a PHP accelerator like APC (highly recommended). 2. Set short_open_tag to off in php.ini*. 3. Set magic_quotes_gpc to off in php.ini*. * Changes to the php.ini file must be done in "/usr/local/php/php.ini". ``` But unfortunatelly i have no access to php.ini on that server. Is that possible magic_quotes_gpc caused that problem? I don't have access to command line too, so i have added project (database, file system, vendors) via ftp, and phpmyadmin. Becouse I don't have problem on my localhost i guess that is problem with server configuration, and I have no access to that, the only way I see is to try to change charset configuration of QueryBuilder. Where can I do that? Do you know what else could cause that problem? Thanks

Original source