When I press certain keys (e.g. German umlauts) in the bash command line, I get escape sequences. For example, ß gives me \303
. These escape sequences are treated as single characters, so one backspace deletes the whole sequence. The character is just displayed wrong on the command line, but it is interpreted correctly, for example typing echo
ß gives:
$ echo \303
ß
I guess it has problems with non 7-bit-ASCII characters. In every other place, these work fine however. I can use them in vim or display them with cat, and also unicode characters work fine.
How can I make bash display these characters correctly?
For the record,
TERM=xterm-256color
LANG=en_US.UTF-8
and from my .inputrc:
set input-meta on # Enable Meta input with eighth bit set
set meta-flag on # Synonym for the above
set convert-meta off # Do NOT strip the eighth bit
set output-meta on # Enable Meta output with eighth bit set
output of stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -cdtrdsr
-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
This Stackoverflow question shows the same symptom, but the posted solution doesn't work: https://stackoverflow.com/questions/13094248/how-do-i-get-accented-letters-to-actually-work-on-bash
I'm also confident that my terminal is properly configured, as it works fine with local bash, but only the bash on a certain remote system (via ssh) has this problem.
echo $LANG
show?stty -a
?ksh
does not have that problem. Inksh
there's also no need to fiddle withstty
or locale settings, so I assume the functions behind those hints are not the cause of the observedbash
issue.