I have a fresh Ubuntu install and I want to connect over ssh in a gnome-terminal. The server uses latin1 (All files etc. are latin1), so I want to use that in the session. I have changed the charset in the menu-option so that characters are output correctly to my screen, but I can't input non-ascii correctly. Should I pass some magic arguments to ssh or is there a setting in gnome-terminal, or should I use stty? I'm a bit lost.


OK. I have now narrowed the problem down a bit. If I run the following on the command line:

php -r 'while ($c = fread(STDIN, 1)) { echo $c; }'

And press a non-ascii key, it echoes out correctly. However, if I type the same key in the shell, nothing happens. So this must be some setting in the shell environment (Locale setting?). Any ideas?

2 Answers 2


The problem most likely has to do with readline, which bash uses. Put the following in either /etc/inputrc or ~/.inputrc:

set meta-flag on
set output-meta on
set convert-meta off

meta-flag enables eight-bit input (that is, it will not clear the eighth bit in the characters it reads), regardless of what the terminal claims it can support. output-meta will enable the display of characters with the eighth bit set directly rather than as a meta-prefixed escape sequence. When convert-meta is on, readline converts characters with the eighth bit set to an ASCII key sequence by stripping the eighth bit and prefixing it with an escape character (in effect, using escape as the meta prefix). We turn it off. Do man readline for more information about these and other variables.

  • Whoohoo .. That was it. Thanks a bunch - This has been haunting me for weeks.
    – troelskn
    Sep 18, 2009 at 6:34

You can change the encoding under Terminal->Encoding on the menu in gnome-terminal. Add the Western (ISO 8859-1) encoding, then switch to it.

  • That changes the display (output), but not the input. I see characters correct, but if I press a key with non-ascii characters, it acts weird.
    – troelskn
    Sep 11, 2009 at 14:15
  • troelskn, both input and output work for me. My version of gnome-terminal is 2.22.3. Sep 11, 2009 at 15:45
  • Thanks, but the problem seems to be related to the remote shell somehow. I've updated my question.
    – troelskn
    Sep 17, 2009 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .