You are not logged in.

#1 2023-06-28 20:35:16

5h4d3
Member
From: Riga, Lativa
Registered: 2023-06-11
Posts: 4

[Solved] SSH + bash troubles with input encoding

Hi! I face this issue for a long time, it's better to describe it on the example:

On ssh session in bash:
1. When I type, e.g., ls, then everything fine, as expected.
2. When I type lsф (non-ASCII symbol, e.g., Cyrillic), then bash trows error like this one and it is expected behavior:
-bash: $'ls\321\204': command not found
3. And most interesting moment, when I type lsф and then remove ф (just by pressing backspace), then bash trows errors like this one:
-bash: $'ls\321': command not found

It's minor issue that annoys me everyday during work.
When I forgot to change keyboard layout from UA to US and tries to continue typing some command,
then all input goes to hell and I need to retype it.
Even if I can just copy part of command using the mouse, it goes to be more and more irritating in last few month.

I've tried to "backspace" few more symbols that before the non-ASCII, but nothing,
if some non-ASCII symbol hits in input, it corrupts whole input and I need to cancel it by Ctrl+C (or just Enter) and redo it.

As a terminal I use the urxvt.
I've tested this issue on lxterminal, everything same.
Advises to switch from bash to another shell not actual, cuz it's standard on servers in my company.

Last edited by 5h4d3 (2023-06-29 20:22:09)

Offline

#2 2023-06-28 20:43:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [Solved] SSH + bash troubles with input encoding

This is - almost certainly - the result of not having a proper locale setup (likely on the ssh host) as this is easily replicated by running `LANG=C bash`.  You need at least some UTF-8 locale.

Last edited by Trilby (2023-06-28 20:44:20)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB