Brian
Brian

Reputation: 19

Why fonts of a table headers don't display correctly inside of SQL Shell (psql)?

Please help me to solve the problem with psql Shell. When i am working inside the SQL Shell the column headers don't display correctly (this should be display in more nicely, do you know to solve it? My operating system is windows 7 ultimate SP1

Like in this example:

                                          ╤яшёюъ срч фрээ√ї
    ╚ь     | ┬ырфхыхЎ | ╩юфшЁютър |     LC_COLLATE      |      LC_CTYPE       |
    ╧Ёртр фюёЄєяр

or like this:

                    ╤яшёюъ юЄэю°хэшщ
 ╤їхьр  |      ╚ь        |        ╥шя         | ┬ырфхыхЎ

The full commands that I wrote in SQL Shell:

Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Пароль пользователя postgres:
psql (10.11)
ПРЕДУПРЕЖДЕНИЕ: Кодовая страница консоли (866) отличается от основной
                страницы Windows (1251).
                8-битовые (русские) символы могут отображаться некорректно.
                Подробнее об этом смотрите документацию psql, раздел
                "Notes for Windows users".
Введите "help", чтобы получить справку.

postgres=# \l
                                          ╤яшёюъ срч фрээ√ї
    ╚ь     | ┬ырфхыхЎ | ╩юфшЁютър |     LC_COLLATE      |      LC_CTYPE       |
    ╧Ёртр фюёЄєяр
-----------+----------+-----------+---------------------+---------------------+-
----------------------
 postgres  | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
 template0 | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
=c/postgres          +
           |          |           |                     |                     |
postgres=CTc/postgres
 template1 | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
=c/postgres          +
           |          |           |                     |                     |
postgres=CTc/postgres
(3 ёЄЁюъш)


postgres=# CREATE TABLE flights (    id SERIAL PRIMARY KEY,    origin VARCHAR NO
T NULL,    destination VARCHAR NOT NULL,    duration INTEGER NOT NULL);
CREATE TABLE
postgres=# \d
                    ╤яшёюъ юЄэю°хэшщ
 ╤їхьр  |      ╚ь        |        ╥шя         | ┬ырфхыхЎ
--------+----------------+--------------------+----------
 public | flights        | ЄрсышЎр            | postgres
 public | flights_id_seq | яюёыхфютрЄхы№эюёЄ№ | postgres
(2 ёЄЁюъш)


postgres=#

I guess, i am not sure, maybe problem is here? But how to add a new fonts to this table?

 postgres=# \l
                                          ╤яшёюъ срч фрээ√ї
    ╚ь     | ┬ырфхыхЎ | ╩юфшЁютър |     LC_COLLATE      |      LC_CTYPE       |
    ╧Ёртр фюёЄєяр
-----------+----------+-----------+---------------------+---------------------+-
----------------------
 postgres  | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
 template0 | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
=c/postgres          +
           |          |           |                     |                     |
postgres=CTc/postgres
 template1 | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
=c/postgres          +
           |          |           |                     |                     |
postgres=CTc/postgres
(3 ёЄЁюъш)

I read this website https://www.postgresql.org/docs/8.4/multibyte.html#AEN29822 this is pretty close to my problem, but according to these information I could only change the text fonts only inside tables, it couldn't change the fonts of the column headers.

Upvotes: 0

Views: 1551

Answers (2)

Malandrey
Malandrey

Reputation: 11

Here i found a permanent solution:

  1. Start -> Run -> regedit
  2. Go to [HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor]
  3. Add new String Value named: Autorun
  4. Change the value to 'chcp 1251'

Upvotes: 1

Brian
Brian

Reputation: 19

The solution is: Step 1. I changed the fonts style of cmd.exe to Lucida Console! Step 2. I used command: chcp 1251 Step 3. I use command: psql -d postgres -U postgres

Now this display correctly and like it should to be!

But every time when you relaunch cmd I need to use chcp 1251, I don't how to save and let it stay permanently. May be you know?

C:\Users\zubr>chcp 1251
Текущая кодовая страница: 1251

C:\Users\zubr>psql -d postgres -U postgres
Пароль пользователя postgres:
psql (10.11)
Введите "help", чтобы получить справку.

postgres=# \l
                                          Список баз данных
    Имя    | Владелец | Кодировка |     LC_COLLATE      |      LC_CTYPE       |
    Права доступа
-----------+----------+-----------+---------------------+---------------------+-
----------------------
 postgres  | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
 template0 | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
=c/postgres          +
           |          |           |                     |                     |
postgres=CTc/postgres
 template1 | postgres | UTF8      | Russian_Russia.1251 | Russian_Russia.1251 |
=c/postgres          +
           |          |           |                     |                     |
postgres=CTc/postgres
(3 строки)


postgres=# \d
                    Список отношений
 Схема  |      Имя       |        Тип         | Владелец
--------+----------------+--------------------+----------
 public | flights        | таблица            | postgres
 public | flights_id_seq | последовательность | postgres
(2 строки)


postgres=#

Upvotes: 0

Related Questions