La pantalla GNU se muestra de manera diferente en diferentes máquinas

La pantalla GNU se muestra de manera diferente en diferentes máquinas

Estoy corriendo

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

en Debian Jessie vía SSH. Si creo un screendesde una máquina que ejecuta Gentoo y luego lo uso desde allí, los caracteres Unicode (específicamente los cirílicos) siempre se imprimen correctamente.

Sin embargo, si creo un screendesde Kubuntu (16.04, actualizado completamente desde 15.04), la codificación no funciona. Considere este script de Python (comandos ejecutados sin 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 
АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
абвгдежзийклмнопрстуфхцчшщъыьэюя
Ёё

Ahora creo un screene intento lo mismo desde allí:

$ screen -S test

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

La codificación también se rompe si creo un screenen Gentoo y luego lo abro desde Kubuntu, pero de una manera diferente: todos los caracteres no latinos se reemplazan por '?' señales.

Utilizo Konsole como terminal tanto en Gentoo como en Kubuntu.

¿Cómo puedo solucionar este problema de codificación?


ACTUALIZACIÓN:siguiendo la sugerencia de @Jakuje, la agregué stty iutf8en ~/.profilela máquina Debian. Después de eso, recibo esto:

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=

Si ejecuto stty -aen la máquina Debian a través de SSH desde Gentoo (con o sin `pantalla), el resultado es exactamente el mismo. Además, 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=

En stty -a, hay 2 diferencias: discard/ flush(línea 4) y -flusho -extproc(línea 8).

La salida interna screencuando sshentro a la máquina Debian desde Kubuntu es la misma que sin screen.

Respuesta1

Tuve un problema similar, mi mensaje utiliza un carácter de flecha especial. Se muestra correctamente a través de ssh, pero aparece un mensaje ?cuando uso la pantalla.

En su sesión ssh, puede iniciar la pantalla con la opción UTF8: screen -U

En esta sesión de pantalla, los caracteres deberían mostrarse normalmente.

Aquí la documentación donde se enumeran las opciones:Manual de usuario de la pantalla

Espero que ayude.

Respuesta2

Esto esproblema conocidocon solución planificada para openssh-7.3 (proyecto de norma). Antes de que esto se solucione en su distribución, existe una solución alternativa para ejecutarlo manualmente (o en algunos de sus scripts de inicio de sesión):

stty iutf8

lo que establecerá sus indicadores tty en utf8, como su shell local.

información relacionada