Psql console does not accept localization

I ran into some strange problem on one of our machines.

This is a new installation of Debian Squeeze with Postgres 8.4.10.

I have several localizations installed on the machine, locale -a gives the following:

C en_US en_US.iso88591 en_US.utf8 POSIX swedish sv_SE sv_SE.iso88591 sv_SE.utf8 

In a regular linux console, I can use swedish localization (åäö works), but when I enter the psql console, I cannot use localized characters. It doesn't matter how I set up my terminal (I tried almost every encoding I can think of).

The database itself works fine, I can enter localized characters by creating an SQL file and keeping the inserts there. This is simply not the most effective way to do this; -)

Have not encountered this problem before, and I installed quite a few machines. Does anyone have any idea what could be causing this?

+6
source share
2 answers

I believe that you have encountered the problem described in this error report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608442

Summary: due to licensing issues, psql is now associated with libedit instead of libreadline, and unfortunately libedit is broken / incomplete with respect to accented characters. According to the report, the workaround is to run psql with:

 LD_PRELOAD=/lib/libreadline.so.5 psql 

or upgrade the postgresql-common package to version 114 or higher. Since this is not in a sustainable branch, the easiest way might be to switch to backports:

 # aptitude -t squeeze-backports install postgresql-common 
+7
source

Check the encoding of the database with \l , then check the client encoding:

 => show client_encoding; client_encoding ----------------- UTF8 (1 row) 

If they do not match, change the client encoding to the database:

 set client_encoding=iso88591; 
0
source

Source: https://habr.com/ru/post/910333/


All Articles