H
H
HaruAtari2014-12-30 22:10:01
linux
HaruAtari, 2014-12-30 22:10:01

How to implement the output of Russian letters in Postgres?

Good evening.
I still can't figure out the Russian letters as a result of the postgres request.
I make a query that returns several lines (they are placed on the terminal):

query result
select * from tbl_log limit 5;
 id | level |  category   |     date_create     |      message
----+-------+-------------+---------------------+-----------------------------------------------------------------------------
 43 | cron  | application | 2013-12-29 22:20:02 | Обновлены счетчики просмотров изображений. 0 просмотров для 0 изображений.
 44 | cron  | application | 2013-12-29 22:25:01 | Обновлены счетчики просмотров изображений. 0 просмотров для 0 изображений.
 45 | cron  | application | 2013-12-29 22:30:01 | Обновлены счетчики просмотров изображений. 2 просмотров для 2 изображений.
 46 | cron  | application | 2013-12-29 22:35:02 | Обновлены счетчики просмотров изображений. 0 просмотров для 0 изображений.
 47 | cron  | application | 2013-12-29 22:40:01 | Обновлены счетчики просмотров изображений. 0 просмотров для 0 изображений.

If you select so many lines that they do not fit into the screen, the database passes the result to vim, and this infernal thing does not show Russian letters. Each line of this query in the editor looks like this:
spoiler
227 | cron  | application                  | 2013-12-30 23:00:01 | <D0><9E><D0><B1><D0><BD><D0><BE><D0><B2><D0><BB><D0><B5><D0><BD><D1><8B> <D1><81><D1><87><D0><B5><D1><82><D1><87><D0><B8><D0><BA><D0><B8> <D0><BF><D1><80><D0><BE><D1>
<81><D0><BC><D0><BE><D1><82><D1><80><D0><BE><D0><B2> <D0><B8><D0><B7><D0><BE><D0><B1><D1><80><D0><B0><D0><B6><D0><B5><D0><BD><D0><B8><D0><B9>. 0 <D0><BF><D1><80><D0><BE><D1><81><D0><BC><D0><BE><D1><82><D1><80><D0><BE><D0><B2> <D0><B4>
<D0><BB><D1><8F> 0 <D0><B8><D0><B7><D0><BE><D0><B1><D1><80><D0><B0><D0><B6><D0><B5><D0><BD><D0><B8><D0><B9>.

If you set the vertical output (\x) in the database terminal, then with several lines - everything is fine, but with large volumes, again the same song with the encoding.
Tell me what I'm doing wrong. What could be the problem? I don't know what to think anymore. I would ask Google, but I don’t know what to ask.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Lopatin, 2014-12-30
@lorus

psql uses the PAGER environment variable for output. Redefine it to something like PAGER=/usr/bin/less instead of vim.

H
HaruAtari, 2014-12-31
@HaruAtari

I went on and on and nothing came of it.
I registered another editor in PAGER - vim is still used. I didn’t find how to enter a command in vim either - when viewing the results, :I press to enter the command, I write e ++enc=utf-8- writes No such file or directory (press RETURN)
As a result, I found that you can disable paging in postgres \pset pager off. The benefit of putty is scrolling.
Thank you for taking your time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question