0

Recently, I encountered some problems while I try to insert some Russian Cyrillic text in a database. I'm on the framework symfony2, I'm using Doctrine ORM and a Nginx web server. The database is a PostgreSql. The problem happens sometimes when I try to insert a russian text in a column, I get a 500 Internal Server Error with this message :

SQLSTATE[22021]: Character not in repertoire: 7 ERREUR: invalid byte sequence for encoding « UTF8 » : 0xd1

And the most weird is that happens in a column and not an other with the same string... My php files and DB are encoding correctly in UTF8.

Is there somebody already encountered the same problem and achieve to solve it ? Thanks a lot for the help.

The \l request show an encoding UTF8 and Collate and Ctype fr_FR.UTF-8

server_encoding UTF8

client_encoding UTF8

Is that the problem ?

  • how are you retrieving the data? is it from a page (user input) or a file, or other database? if it's from another page, does that page declare a character encoding at the document level? – Jeff Lambert Jul 08 '14 at 15:55
  • 2
    Show the output of `\l` for the database in `psql` please, and the result of running the query `SHOW server_encoding;` and `SHOW client_encoding;` from your application. – Craig Ringer Jul 08 '14 at 23:54
  • I edit my question with the query response, but all seems to be fine... – user3816913 Jul 10 '14 at 12:57

1 Answers1

0

I have such problem too. It occurs when I upload data from Cyrillic files. The only solution is worked for me is set such config.

dbal:
    charset:  SQL_ASCII

I am not sure if that is correct but it worked for me! As far as i know it stops validate encoding in such way.