ssh backspace deletes one character instead of two (utf-8 symbols)

3

Im accessing a remote computer using ssh and running a bash command to input symbols using standard input stream:

read test;echo $test

It's ok to input english letters and use backspace to delete them, then input other characters and iterate this steps any amount of times. But it becomes a disaster when I use other utf-8 symbols, like russian ones, which require 2 bytes instead of 1, as english ones do. E.g., I input:

абвгдежз

After that, I use backspace for 8 times, and input other symbols:

привет

And press Enter key. But instead of the result which would equal my last input, I get the following:

абвгпривет

Which means that 8 backspace deleted only 4 symbols.

I do use linux ubuntu 12.04. Tried different consoles: standard one, terminator; different types of backspace options (as ASCII-del or Ctrl+H); setting $LC_TYPE to ru_RU.UTF-8, but nothing works. There is no such a problem using local console. Thank you in advance.

update: I've also got a video of this issue, please watch it at youtube

Vsevolod Avramov

Posted 2013-04-24T05:28:11.063

Reputation: 33

Answers

2

You can work around this by running

stty iutf8

on the server each time you ssh there. Unfortunately this bug exists since 2005 year, watch though the debian forums for details. You may also want to add this line at the end of your .bashrc file.

twonegatives

Posted 2013-04-24T05:28:11.063

Reputation: 136

3

You need to set LC_CTYPE to a UTF-8 locale, e.g. ru_RU.UTF-8 or en_US.UTF-8. You can list available locales using locale -a.

NCao

Posted 2013-04-24T05:28:11.063

Reputation: 131

Thank you for your reply. I've already got $LC_TYPE set up as ru_RU.UTF-8 both on client and server side. Sadly, that does not resolve an issue. – None – 2013-04-24T07:34:54.937

@VsevolodAvramov Did you try to export that variable? And: When did you set it? If you set it in the shell, it might be too late... – glglgl – 2013-04-24T07:40:11.937

@glglgl, I've got the following configuaration:

  1. First lines of ~/.ssh/config are:

Host * SendEnv LC_* 2) AcceptEnv directive is present in the server configuration at /etc/ssh/sshd_config 3) First lines of ~/.bashrc both on client- and serverside are export LC_CTYPE=ru_RU.utf8 4) locale -a shows ru_RU.utf8 in the list of available options for locale. Any more ideas? Thanks. – None – 2013-04-24T08:02:07.730

@glglgl I've also recorded a video which proves that variable LC_ENV is set up properly. Please watch it at youtube

– None – 2013-04-24T08:20:23.557