I have installed Odoo12 on Ubuntu 18.04 using installation script Odoo Install The server started successfully and when trying to create the first database, the error below showed up.
Database creation error: encoding "UTF8" does not match locale "en_US" DETAIL: The chosen LC_CTYPE setting requires encoding "LATIN1".
then I have run the below script which has solved the problem before on odoo 10. it was run from postgres user
psql postgres -c "update pg_database set datallowconn = TRUE where datname = 'template0';"
psql template0 -c "update pg_database set datistemplate = FALSE where datname = 'template1';"
psql template0 -c "drop database template1;"
psql template0 -c "create database template1 with ENCODING = 'UTF-8' LC_CTYPE = 'en_US.utf8' LC_COLLATE = 'en_US.utf8' template = template0;"
psql template0 -c "update pg_database set datistemplate = TRUE where datname = 'template1';"
psql template1 -c "update pg_database set datallowconn = FALSE where datname = 'template0';"
As the problem persisted I installed phpPgAdmin and noticed that the Encoding is still "Latin1" ; So I droped the database and created a new one manually from the phppgAdmin interface using same name and same owner. below is a shot from the phpPgAdmin phpPgAdmin shot screen
Still the same problem unresolved and the error is shown as seen below. Odoo Encoding Error message
Noting that this is the return of calling "locale" on my server. locale status