Database creation error: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.
If you get the above error while creating database from Odoo database manager or if you are creating a new database in postgresql but its Encoding is SQL_ASCII and Collate & Ctype is C.
here is the solution for you.
You need to run following queries as a postgresql administrator.
update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with encoding = 'UTF-8' lc_collate = 'en_US.UTF8' lc_ctype = 'en_US.UTF8' template = template0;
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0';
\q
After running these queries, you will be able to create database from Odoo database manager without any error as well as your new created database in postgresql has Encoding UTF8 and Collate & Ctype will be en_US.UTF-8.