So. I am using PuTTY to connect to a remote server that has an irssi client running for me constantly through tmux.

Connecting to the server, and typing "tmux attach" works fine and everything works as it is supposed to. Unicode characters show up just fine.

However, if I instead set a "Remote command" in the Connection -> SSH options of "tmux attach." Tmux attaches and then Unicode doesn't work.

I assume this might have something to do with the system terminal variable, but I have no idea.

Any ideas on how to fix?

  • what is the value of $TERM on the remote machine? Also, please explain the meaning of "remote command in the connection" ... is this ssh username@server -t 'tmux' or some variant? – scicalculator Sep 4 '11 at 15:49
  • I don't know how to check $TERM when using a remote command, and I don't know, re: what the meaning of remote command is. The software doens't say. – Navarr Sep 4 '11 at 19:33
  • No problem, when you connect to the remote machine without "remote command", type echo $TERM (this tells you the value of TERM), I expect "xterm" or something similar. Attach the session and check the output of the same command (it won't be the same). Also, when you connect with "remote connection" being "tmux attach" give the output of the same command, I expect "screen" or something similar. Next, just to make sure, you setup putty to display UTF-8? Also, have you added set term_charset in the irrsi config files? – scicalculator Sep 5 '11 at 1:49
  • Sorry, also, it might be helpful to know what value of LANG you are using echo $LANG – scicalculator Sep 5 '11 at 1:57

hmmm ... I just realized this can be made much simpler. You said that you can perfrom the following tasks

  1. connect to the server normally
  2. attach tmux
  3. run irssi/other-things with no unicode bugs.

If you can connect to the shell of your server, why not add tmux attach to your .*rc file? If you would like to attach to tmux most times you connect to the server, just have the server automatically attach when you connect (every time).

Using some putty-specific connection method is a bad idea, in my opinion, because it may not work well when/if you change your method of connecting ie. if you change to a non-windows computer. So, instead of attaching to the session by using putty's "remote command", just connect regularly. If you are using a bash shell, add this to the $HOME/.bashrc file on the server:

if [[ ! -n $TMUX ]] ; then tmux attach ; fi

Then, as soon as you connect it will automatically attach to the tmux session. You can always leave tmux by using detaching:tmux detach (or you can kill every tmux session killall tmux if you want to start over).

Of course, if you like, you can then begin to think of a more complex tmux attachment script that creates a custom-new-session OR attaches. Personally, every time I open a terminal, it launches a tmux session script (113 lines long), which sets it up just like I like it ... or it attaches if the session already exists.

  • I like your answer.. its a way to do it. And although it doesn't answer the problem posed, it certainly IS a solution to my personal problem. I am curious though, as to why this happens. – Navarr Sep 7 '11 at 4:03
  • @Navarr, I agree that it is strange behavior. I suspect that PUTTY may be forcing a different TERM or LANG variable when connecting using the "remote command". There may be an option for this, but I have limited experience with PUTTY (perhaps remote-command: "source $HOME/.bashrc" would help the mystery?). In principle, the only reason to use putty's "remote-command" is to run a program and have the shell quit after it finishes (i.e. the shell exits after you detach). With my work-around, you should be able to just close the window and have no problems because tmux should automatically detach. – scicalculator Sep 7 '11 at 9:15

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.