I'm actually stuck trying to update encoding of my PostgreSQL layers to be able to set my project as QGIS server project.

QGIS server configration Check

In the layers properties, I can't change the layer's encoding.

Layer's encoding

Any hints on how to proceed?


The PostgreSQL layers are stored within your database. Your database has a specific encoding set, so the layers provided are in the same encoding as your database.

Usually when creating a new database the encoding will be preset as the system one. I don't see any advantage of changing encoding on the fly, since it sounds quite resource hungry.

I would recommend changing the encoding of the whole database. The quickest way would be:

  1. Dump your database with pg_dump.

  2. Create a new database with new encoding.

  3. Restore the dumped database into your new database.

Hopefully it will restore without encoding errors.

You can read more about changing database encoding here.


In my case, the database encoding was right :

  WITH OWNER = postgres
       ENCODING = 'UTF8'
       TABLESPACE = pg_default
       LC_COLLATE = 'French_France.1252'
       LC_CTYPE = 'French_France.1252'

The .qgs project was constructed with another database in another encoding. Then was switched to my actual database.

I reloaded the layers as new layers in the project and fetch the styles from the old ones.

Layer encoding is now correct.

Encoding corrected

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.