I use PuTTY often when I'm on a Windows machine to connect to my Linux boxes to do work. I also use TMUX and NPM which both do line-drawings to display UI.

NPM

When listing a tree of installed modules, NPM uses lines to draw a tree. I noticed that in PuTTY this comes out as goop. This issue is similar to an issue with the Tree utility.

ââ⬠nano@4.1.3
  âââ errs@0.2.4
  ââ⬠follow@0.9.0
  â ââ⬠request@2.16.6
  â   âââ aws-sign@0.2.0

The fix for this is easy, in the PuTTY settings, change the Remote character set: in Window -> Translation to UTF-8, most Linux OSs will have their charset configured for UTF-8 out-of-the-box so this is the correct setting anyway.

TMUX

For reasons that are understood by people smarter than me TMUX and PuTTY don't jive because TMUX tries to send Unicode Alternate Charset (ACS) commands to PuTTY when it shouldn't (when PuTTY is in UTF-8 mode). So the fix above for Tree and NPM broke the lines in TMUX and made them all letters. Not cool.

For a second I just about gave up and went with making TMUX look decent and eschew my beautiful lines in NPM. Well a little more reading and I found that if TMUX realizes that your emulator is expecting UTF-8, then it will use UTF-8 characters for drawing the lines instead of ACS.

TMUX looks for "UTF-8" in the environment variables LC_ALL, LC_CTYPE, and LANG or checks if it was run with the command-line switch -u and will switch to using "UTF-8" characters for line drawing.

I wasn't too excited about always remembering to do tmux -u attach and the only locale on my Linux box (Gentoo) is en_US.UTF8 so I set LANG="en_US.UTF-8" and LC_COLLATE="C" in my /etc/env.d/02locale file.

YAY!

Perfect, now I've got the UTF-8 lines for Tree and NPM working as well as informing TMUX that I'm a UTF-8 junky so that it'll change to that mode too. The world now seems so much more beautiful and soft to me.