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.
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.
âââ¬ email@example.com âââ firstname.lastname@example.org âââ¬ email@example.com â âââ¬ firstname.lastname@example.org â âââ email@example.com
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.
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
LC_COLLATE="C" in my
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.