The locale may be needed to be added to the Linux OS, if it has not been already.

1. sudo locale-gen "en_US.UTF-8"

2. sudo dpkg-reconfigure locales

    select en_US.UTF-8 with the space key

3. sudo systemctl restart postgresql

Get the psql program to run the following command.

sudo -i -u postgres
psql

Then this will create a UTF8 database in PostgreSQL.

CREATE DATABASE "database_name"
  WITH OWNER "postgres"
  ENCODING 'UTF8'
  LC_COLLATE = 'en_US.UTF-8'
  LC_CTYPE = 'en_US.UTF-8' 
  TEMPLATE = template0;

Postgresql is a solid database. Creating UTF8 databases for projects ensures that English and international characters are supported and ready for production.

Happy Coding!

Addendum, locale code for the Linux OS.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *