the encoding issues about match locale in openGauss

51 Views Asked by At

First retrieve possible supported encodings using the following query

SELECT DISTINCT pg_catalog.pg_encoding_to_char(conforencoding) FROM pg_catalog.pg_conversion;

Then create the databases using encodings from the previous list

CREATE DATABASE test_WIN1256 WITH ENCODING = 'WIN1256';

get the error

ERROR: encoding "WIN1256" does not match locale "en_US.UTF-8" DETAIL: The chosen LC_CTYPE setting requires encoding "UTF8".

How to deal with the error?

1

There are 1 best solutions below

0
On

you can set the LC_ALL in ~/.bashrc and ~/.profile files:

export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
export LANGUAGE=en_US.utf-8

and then source the .bashrc:

$ source ~/.bashrc

Verify set with locale command re-ran the install again.

You can also create the database with specific LC_CTYPE, like:

CREATE DATABASE test_WIN1256 WITH ENCODING 'WIN1256' \
 LC_CTYPE 'en_US.UTF-8' LC_COLLATE 'en_US.UTF-8';