Linux – Making 256-color AND Line drawing characters both work in PuTTY

linuxncursesputtyterminal

I'm having trouble setting up PuTTY with Ubuntu.

I'm trying to get line characters to work in aptitude as well as 256-color support, but can only get one or the other.

  • Ubuntu Config
    • Using 64-bit Ubuntu
    • Terminal type xterm-256color or putty-256color gives 256-color, but incorrect line characters.
    • Terminal type linux gives proper lines in aptitude, but only 16 colors.
  • PuTTY Config
    • Using font with Unicode characters. (DejaVu Sans Mono)
    • Received Data is assumed to be in UTF-8.
    • Set to use Unicode line drawing code points.

Output from locale:

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

Best Answer

The problem is that PuTTY in UTF-8 mode ignores1 VT100 "Alternate character set" commands, and ncurses attempts to use the "graphical" character set for drawing the GUI. (The box drawing characters are in the same positions as klmqx would normally be.)

export NCURSES_NO_UTF8_ACS=1 to your environment, it should fix the problem by telling ncurses to always use Unicode box drawing characters when a UTF-8 locale is selected.

1 There is a PuTTY wishlist entry for this, along with explanation why the current behavior is better.

Update (2018-05-12): It seems that this combination will be supported in PuTTY 0.71.

Update: PuTTY now has the option "Enable VT100 line drawing even in UTF-8 mode" in the settings Window -> Translation.

Related Question