Квадратики в терминале

Russian forum

Moderator: posixru

User avatar
AlYuSed
Posts: 23
Joined: 21. Aug 2017, 03:34
Location: Russia

Квадратики в терминале

Post by AlYuSed » 24. Aug 2017, 13:40

Вроде бы банальная проблема, но я ничего толком не нагуглил. Либо устаревшие советы времен ядра 2.x (танцы вокруг koi-8 и все такое), либо советы про обычный терминал (а не графический, из XFCE), либо совет не работает.

Image

LANG=ru_RU.utf8
В файле rc.font прописано setfont -v ter-v22b
Попытка написать то же самое в терминале XFCE выдает ошибку: Не удалось получить файловый дескриптор, указывающий на консоль

Что делать и кто виноват?
Anyone who on 24 October, 1917 had a chance to snort cocaine on the deserted and inhuman Petrograd avenues, knows that man is not the king of nature. -- Victor Pelevin, "Crystal world"

DidierSpaier
Posts: 325
Joined: 20. Jun 2016, 20:15

Re: Квадратики в терминале

Post by DidierSpaier » 25. Aug 2017, 13:56

AlYuSed wrote:Что делать и кто виноват?
Nobody's to blame but for Russian the right font is ter-k22b. I just checked, all characters are properly rendered then.

See /usr/doc/terminus-font-4.40/README to know more.

And xfce4-terminal is right, terminus fonts are in PSF format intended for the Linux console, not suitable under X. Try a DejaVu font instead, whatever.

PS Sorry I don't speak Russian and my native language is French, so I answer in English.

User avatar
AlYuSed
Posts: 23
Joined: 21. Aug 2017, 03:34
Location: Russia

Re: Квадратики в терминале

Post by AlYuSed » 26. Aug 2017, 04:06

DidierSpaier wrote:Nobody's to blame
It's just an idiom. :)
https://fr.wikipedia.org/wiki/Que_faire ... nychevski)
https://en.wikipedia.org/wiki/Who_is_to_Blame%3F
but for Russian the right font is ter-k22b. I just checked, all characters are properly rendered then.
KOI-8R is obsolete. Apparently, the man pages are written using this encoding, that's why I have everything well displayed in Russian, apart from them. As a quick and dirty solution I do this: LANG=C man slapt-get
And xfce4-terminal is right, terminus fonts are in PSF format intended for the Linux console, not suitable under X. Try a DejaVu font instead, whatever.
Russian letters are displayed normally with Terminus, but not in the man pages. The only difference is that now man pages do not display the squares, but the question marks.
PS Sorry I don't speak Russian and my native language is French, so I answer in English.
I think I'll just switch the system language to English. I freely read technical English, so it is comfortable for me. Besides, this is not the only inconvenience. For example, folders in the home directory are created with Russian letters. They are displayed normally in the console and in GUI, but it is inconvenient: I have to switch from English keyboard layout to Russian and vice versa. But we are lazy slackers, right? :)
Anyone who on 24 October, 1917 had a chance to snort cocaine on the deserted and inhuman Petrograd avenues, knows that man is not the king of nature. -- Victor Pelevin, "Crystal world"

DidierSpaier
Posts: 325
Joined: 20. Jun 2016, 20:15

Re: Квадратики в терминале

Post by DidierSpaier » 26. Aug 2017, 17:22

AlYuSed wrote:KOI-8R is obsolete.
It is not obsolete at all. It is just not intended for an X terminal, but only for a Linux console. And it is indeed suitable for Russian as it includes all the needed glyphs.

You can check that: just type in a Linux console (not in xfce4-terminal)

Code: Select all

showconsolefont
to display all glyphs included in the loaded font.
AlYuSed wrote:Apparently, the man pages are written using this encoding, that's why I have everything well displayed in Russian, apart from them.
No. the man pages are written in UTF-8 encoding but the Terminus fonts include an UTF-8 table that maps the Unicode code point of a given character to its legacy 8-bits encoding, in this specific case KOI8-R.

This is necessary because a plain Linux console can display only a set of 256 character at any given time.

To overcome this limitation, you would need to use instead a framebuffer terminal like fbterm.
AlYuSed wrote:As a quick and dirty solution I do this: LANG=C man slapt-get
Not a solution at all.
Russian letters are displayed normally with Terminus, but not in the man pages. The only difference is that now man pages do not display the squares, but the question marks.
Again Terminus fonts are not intended for an X terminal at all.

The solution is to just setup correctly xfce4-terminal. I will refer to Terminal's menu in English.

1) Click Edit => Preferences => Appearance and choose for instance the font "DejaVu sans Mono Book" with the size you prefer.
2) Click Terminal => Set Encoding and choose "Default (UTF-8)"

If I do that, then start Terminal with LANG set to ru_RU.utf8 and type "man slapt-get", here is what I get:Image

reedych
Posts: 37
Joined: 11. Mar 2017, 05:24

Re: Квадратики в терминале

Post by reedych » 27. Aug 2017, 12:18

Это только в MAN? Попробуй в /etc/man.conf поменять строку "NROFF <что-то там>" на: "NROFF /usr/bin/groff -Dutf8 -Tutf8 -mandoc"

DidierSpaier
Posts: 325
Joined: 20. Jun 2016, 20:15

Re: Квадратики в терминале

Post by DidierSpaier » 27. Aug 2017, 14:32

In ~/.profile in Slint we write

Code: Select all

export GROFF_ENCODING=UTF-8
I think that the same setting is made in Salix (maybe in another file like ~/.bashrc or ~/.bash_profile, I don't remember exactly).

User avatar
AlYuSed
Posts: 23
Joined: 21. Aug 2017, 03:34
Location: Russia

Re: Квадратики в терминале

Post by AlYuSed » 28. Aug 2017, 14:09

reedych wrote:Это только в MAN? Попробуй в /etc/man.conf поменять строку "NROFF <что-то там>" на: "NROFF /usr/bin/groff -Dutf8 -Tutf8 -mandoc"
Поменял, эффекта нет.
Anyone who on 24 October, 1917 had a chance to snort cocaine on the deserted and inhuman Petrograd avenues, knows that man is not the king of nature. -- Victor Pelevin, "Crystal world"

User avatar
AlYuSed
Posts: 23
Joined: 21. Aug 2017, 03:34
Location: Russia

Re: Квадратики в терминале

Post by AlYuSed » 28. Aug 2017, 14:11

DidierSpaier wrote:In ~/.profile in Slint we write

Code: Select all

export GROFF_ENCODING=UTF-8
I think that the same setting is made in Salix (maybe in another file like ~/.bashrc or ~/.bash_profile, I don't remember exactly).
There has already been written utf8, I changed to UTF-8, but to no avail.

I have a feeling that the cure is worse than the disease. I have already said that for me it is not a problem. I find it easier to change the system language to English.
Anyone who on 24 October, 1917 had a chance to snort cocaine on the deserted and inhuman Petrograd avenues, knows that man is not the king of nature. -- Victor Pelevin, "Crystal world"

User avatar
posixru
Posts: 439
Joined: 27. Mar 2010, 14:54
Location: СССР
Contact:

Re: Квадратики в терминале

Post by posixru » 1. Sep 2017, 22:27

AlYuSed wrote:Вроде бы банальная проблема, но я ничего толком не нагуглил. Либо устаревшие советы времен ядра 2.x (танцы вокруг koi-8 и все такое), либо советы про обычный терминал (а не графический, из XFCE), либо совет не работает.
Давно такого не видел, но в памятках-рецептах проверенных на 13.37 по этому поводу имеется запись...
Советуется содержимое файла /etc/rc.d/rc.font заменить на:

Code: Select all

#!/bin/sh

unicode_start LatArCyrHeb-16
for i in 1 2 3 4 5 6;do
  echo -ne "\033%G" >/dev/tty$i
done
Помечено что помогло, хотя подробностей я уже не помню.
Image

User avatar
AlYuSed
Posts: 23
Joined: 21. Aug 2017, 03:34
Location: Russia

Re: Квадратики в терминале

Post by AlYuSed » 6. Sep 2017, 10:31

Apparently, the problem is not in the system settings, because some man-pages are displayed correctly.

Image Image
Anyone who on 24 October, 1917 had a chance to snort cocaine on the deserted and inhuman Petrograd avenues, knows that man is not the king of nature. -- Victor Pelevin, "Crystal world"

Post Reply