SlimenTN
SlimenTN

Reputation: 3564

Doctrine change UTF8 encoding to html entities when saving data in database

I don't know where this problem is coming from although I did not touch doctrin's configuration but when I send to database a word with special characters like this (Réparation) doctrine save it this way (Réparation) !!
I'm using latin1_swedish_ci as Interclassement in both database and table.
and this is doctrin's configuration in config.yml file:

# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8

What am I doing wrong ?

UPDATE:
I just found that only one column save data this way if I use another column date are saved correctly !!
How do you explain this ?

Upvotes: 2

Views: 1134

Answers (2)

SlimenTN
SlimenTN

Reputation: 3564

I found where this problem is coming from:
It was from tinymce (the WYSIWYG editor) that converts the special characters to html_entities.

Upvotes: 0

Vamsi Krishna B
Vamsi Krishna B

Reputation: 11490

try this.

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

1002 is the value for the constant PDO::MYSQL_ATTR_INIT_COMMAND

Upvotes: 1

Related Questions