2

I am sshing into a centos box from an ubuntu box. I keep seeing è when I type alt+h (aka M-h). I want to use this key combo in tmux bindings but it doesn’t work because tmux doesn't recognize utf8 characters. I don’t have this problem on my Ubuntu box.

My wild guess is this is somehow related to locale. Here is my locale output on CentOS:

LANG=en_US.UTF-8
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=

I did notice that on Ubuntu I have an additional LANGUAGE=en_US:en line in my locale output.

Any suggestions?

3
  • Just wondering...does pressing Esc followed by H cause the same character to be output? – BenjiWiebe Jul 15 '14 at 19:07
  • @BenjiWiebe Esc H does not produce the same char – Eric Johnson Jul 15 '14 at 19:34
  • Hmmm... BTW, Esc H should be the key combo you want, if Alt H doesn't work you could use Esc H. But I understand that you want to know WHY Alt H doesn't work. And, to tell the truth, so do I. +1 – BenjiWiebe Jul 15 '14 at 19:52
0
tput rmm

Seems to solve my problem. Mostly. But I don't entirely understand why.

When I run infocmp on my centos box I see that rmm and smm have values but they don't on my ubuntu box. From the terminfo man page I learned that rmm "turns meta mode off" and smm "turns meta mode on".

Also it doesn't seem to work to add tput rmm to my .bashrc. I have to manually run it from my centos shell. Again I don't understand why.

1
  • Ubuntu's terminal database is farther in the past than CentOS (long story). The upstream change was made in 2006, to match xterm. – Thomas Dickey May 2 '15 at 23:37
0

Turning off meta mode is part of the answer. xterm has more than one configurable feature related to this. The ncurses FAQ Alt-keys do not work in bash provides some of the background. Essentially, there are two notions of what meta mode is:

  • xterm and the terminal database (terminfo) document the use of a meta key as a sort of shift-modifier, setting the eighth bit of an input byte. xterm's manual has some notes on the topic in the section for the eightBitInput resource. The terminfo manual is more succinct:

If the terminal has a "meta key" which acts as a shift key, setting the 8th bit of any character transmitted, this fact can be indicated with km. Otherwise, software will assume that the 8th bit is parity and it will usually be cleared. If strings exist to turn this "meta mode" on and off, they can be given as smm and rmm.

  • bash says it expects an escape character to prefix the character to which the meta key is applied. (There is no record of how bash came to decide this, and that it was the meta key, but it goes back to the early 1990s at least).

So the problem is that xterm implemented a control sequence for turning meta mode on/off, and bash had some expectations about what to do with it. The odd thing is that whatever terminal bash was prepared for was not noted (it certainly was not xterm). However, just in case bash ever sees that terminal again, it turns on meta mode by default for any terminal which implements it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.