A tela GNU é exibida de forma diferente em máquinas diferentes

A tela GNU é exibida de forma diferente em máquinas diferentes

eu estou correndo

$ screen --version
Screen version 4.03.01 (GNU) 28-Jun-15

no Debian Jessie via SSH. Se eu criar um screena partir de uma máquina rodando o Gentoo e depois usá-lo a partir daí, os caracteres Unicode (cirílicos, especificamente) serão sempre impressos corretamente.

No entanto, se eu criar um screena partir do Kubuntu (16.04, atualizado desde 15.04), a codificação será quebrada. Considere este script Python (comandos executados sem screen):

$ cat test.py 
print(''.join(chr(c) for c in range(ord('А'), ord('Я') + 1)))
print(''.join(chr(c) for c in range(ord('а'), ord('я') + 1)))
print('Ёё')

$ python3 test.py 
АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
абвгдежзийклмнопрстуфхцчшщъыьэюя
Ёё

Agora eu crio um screene tento o mesmo a partir daí:

$ screen -S test

$ python3 test.py 
�БВГДЕЖЗИЙКЛ����РСТУФХЦЧШЩЪЫЬЭЮЯ
абвгдежзийклмноп�����
        ��           �
��������

A codificação também é quebrada se eu criar um screenno Gentoo e depois abri-lo no Kubuntu, mas de uma maneira diferente: todos os caracteres não latinos são substituídos por '?' sinais.

Eu uso o Konsole como meu terminal no Gentoo e no Kubuntu.

Como posso corrigir esse problema de codificação?


Atualização:seguindo sugestão de @Jakuje, adicionei stty iutf8na ~/.profilemáquina Debian. Depois disso, estou recebendo isso:

Gentoo, terminal local:

$ stty -a
speed 38400 baud; rows 55; columns 243; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

$ locale
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

Se eu executar stty -ana máquina Debian via SSH do Gentoo (com ou sem tela), a saída será exatamente a mesma. Além disso, Gentoo -SSH-> Debian:

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Kubuntu, terminal local:

$ stty -a
speed 38400 baud; rows 43; columns 172; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

$ locale
LANG=ru_RU.UTF-8
LANGUAGE=fr:en_US:es:ru
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC=ru_RU.UTF-8
LC_TIME=ru_RU.UTF-8
LC_COLLATE=ru_RU.UTF-8
LC_MONETARY=ru_RU.UTF-8
LC_MESSAGES=POSIX
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=ru_RU.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=

Kubuntu -SSH-> Debian:

$ stty -a
speed 38400 baud; rows 43; columns 172; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=ru_RU.UTF-8
LC_TIME=ru_RU.UTF-8
LC_COLLATE=ru_RU.UTF-8
LC_MONETARY=ru_RU.UTF-8
LC_MESSAGES=POSIX
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=ru_RU.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=

Em stty -a, existem 2 diferenças: discard/ flush(linha 4) e -flusho -extproc(linha 8).

A saída de dentro screenquando sshentro na máquina Debian do Kubuntu é a mesma que sem screen.

Responder1

Eu tive um problema semelhante, meu prompt está usando um caractere de seta especial. Exibido corretamente no ssh, mas recebi uma mensagem ?ao usar a tela.

Na sua sessão ssh, você pode iniciar a tela com a opção UTF8: screen -U

Nesta sessão de tela, os caracteres devem ser exibidos normalmente.

Aqui está a documentação onde as opções estão listadas:Manual do usuário da tela

Espero que ajude.

Responder2

Isso éproblema conhecidocom correção planejada para openssh-7.3 (projeto de norma). Antes que isso seja corrigido em sua distribuição, há uma solução alternativa para executar manualmente (ou em alguns de seus scripts de login):

stty iutf8

que definirá seus sinalizadores tty como utf8, como seu shell local.

informação relacionada