I'm actually stuck trying to update encoding of my PostgreSQL layers to be able to set my project as QGIS server project.
In the layers properties, I can't change the 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:
Dump your database with pg_dump.
Create a new database with new encoding.
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 :
CREATE DATABASE sdis 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.