Search code examples
postgresqlasp.net-coreentity-framework-coreazure-database-postgresql

Azure database for postgreSQL Flexible Server and Entity Framework Core shows accented spanish words incorrectly


I have created a Flexible Server (Azure database for postgreSQL), I am using pgadmin to connect to this database (Encoding UTF8), I have a table named skills, and using pgadmin shows the spanish words correctly.

  • SHOW SERVER_ENCODING; UTF8
  • SHOW CLIENT_ENCODING; SQL_ASCII

enter image description here

The problem is when I connect entity framework core to this database, shows accented spanish words incorrectly, for example:

  • Publicación (Correct)
  • Publicaci\xf3n (Incorrect)

When I send data from Web API to database it is inserted this way

  • Publicación

Solution

  • There is an option in Azure Database for PostgreSQL flexible server is Server Parameters,

    Inside there is a parameter:

    client_encoding was SQL_ASCII and I changed to UTF8

    enter image description here

    then my pgadmin shows accented spanish words correctly, that was the solution