How to fix PuTTY showing garbled characters?

202,854

Solution 1

You almost certainly have set the wrong character set in your PuTTY settings.

Verify the character set on the remote system by running the command:

locale

This should return something like:

LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

So check your PuTTY settings under Translation and ensure that you have UTF-8 set as the character set.

PuTTY Reconfiguration

You may need to tweak the line drawing setting as well, but it is probably not likely.

Solution 2

I had an issue with Debian's aptitude program even though I had UTF-8 as my characters set. What worked for me was to set the 'Connection > Data > 'Terminal-type string' to 'putty' instead of 'xterm' - apparently Putty ignores the character sequence to switch into drawing mode: http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/utf8-plus-vt100.html

enter image description here

Solution 3

After 15 years I got annoyed once more and googled around again, found this, chose

change settings → window → translation → remote char set → "use font encoding"

and that fixed it.

Solution 4

Also, if UTF-8 is not properly configured, you may run it as mc -ac.

Credits: http://blog.acsystem.sk/linux/midnight-commander-utf8-line-drawing-characters-problem

Solution 5

Window → Translation → "Enable VT100 line drawing even in UTF-8 mode".

This fixes the display of both mc and wavemon for me.

enter image description here

Share:
202,854

Related videos on Youtube

Uwe Keim
Author by

Uwe Keim

German developer. Some of my apps: SharePoint Systemhaus Göppingen (zwischen Stuttgart und Ulm) Eigene Homepage erstellen Test Management Software Windows 10 Ereignisanzeige Very proud father of Felix (2012) and Ina (2014). Loves running, climbing and Indian food. Code Project member #234.

Updated on September 18, 2022

Comments

  • Uwe Keim
    Uwe Keim almost 2 years

    Connecting from a Windows 7 PC via SSH to an Ubuntu server using PuTTY, I get some screen errors:

    enter image description here

    I.e. it:

    • "Double-draws" the selection inside Midnight Commander (MC).
    • Other characters like line elements are drawn as the wrong characters (e.g. "â" instead of "|").

    I connected to the same Ubuntu server with a terminal and SHH from a Mac OS X and do not get these screen garbling (i.e. everything looks and works correctly). I've already tried to play with the font settings inside PuTTY, changing it from Courier New to Consolas but without luck.

    My question therefore is:

    How to configure PuTTY to correctly display special characters and not double-draw/overwrite screen lines?

    • Vunb
      Vunb almost 5 years
      With SecureCRT: Select Options -> Session Options -> Terminal -> Appearence -> Character encoding -> select: UTF-8. Hope help others like me!
  • Piotr Jurkiewicz
    Piotr Jurkiewicz over 9 years
    This is not sufficient in all cases. You should also export the following variable to your environment: NCURSES_NO_UTF8_ACS=1 [more info]
  • Nate
    Nate about 9 years
    Excellent. Easy and it works. (At least it does on Debian/Ubuntu.)
  • user2693017
    user2693017 almost 9 years
    in case locale returns POSIX you probably have usePAM disabled in the sshd config
  • koppor
    koppor over 8 years
    If the locale returns something like POSIX, issue update-locale LANG=en_US.utf8 at the command line - see thomas-krenn.com/de/wiki/Locales_unter_Ubuntu_konfigurieren
  • ADTC
    ADTC about 8 years
    This works well (on PuTTY) but then it introduces another (more minor) problem: remote-controlled window title changing no longer works.
  • Michael Hampton
    Michael Hampton over 7 years
    You should also mention that you're not connecting to a modern LInux system, but an older non-Linux system.
  • alpha_989
    alpha_989 over 6 years
    @michael-hampton, my system is configured to use en_US.UTF-8. I see that different places say different things about locale. Some places mention I should use en_US while other places mention I should use de_DE. I saw before the grep and other core utils use the locale to set the character set, I believe. What are the implicaitons of changing this?
  • alpha_989
    alpha_989 over 6 years
    @koppor, you mentioned about changing locale to en_US, while michael mentioned changing locale to de_DE. Which one is correct?
  • alpha_989
    alpha_989 over 6 years
    What are the side-effects of changing LANG variable? If you already had C.UTF-8 as LANG, why export it again?
  • alpha_989
    alpha_989 over 6 years
    Ahh ok, makes sense. Thanks for the explanation @Michael-hompton. Yeah.. I thought so too. But I noticed that you are in NH.. not Germany. So was not sure about whether I should be using that. Anyways, the problem I was having was not related to this, but I figured it out: superuser.com/questions/278286/….
  • weberjn
    weberjn over 6 years
    Excellent. Solved the problem for ncmpc on Ubuntu Artful.
  • HeatfanJohn
    HeatfanJohn almost 6 years
    export NCURSES_NO_UTF8_ACS=1 worked best for me. I just need to remember to use the -E option on sudo when I run iftop to keep that environment setting. sudo -E iftop
  • Martin
    Martin over 5 years
    This fixed it for me.
  • tehnicaorg
    tehnicaorg over 3 years
    Yeah, this fixes aptitude, iptraf-ng without breaking mc. (with Terminal type string set to either xterm or xterm-256color). See also superuser.com/questions/278286/…
  • tehnicaorg
    tehnicaorg over 3 years
    NCURSES_NO_UTF8_ACS=1 is not needed anymore. See superuser.com/questions/278286/… on how to enable VT100 drawing characters in PuTTY 0.71+.
  • SergeantSerk
    SergeantSerk over 3 years
    For me, UTF-8 was already set but it didn't work, instead setting it to this did.
  • Chupo_cro
    Chupo_cro almost 3 years
    When I set Use font encoding then for example armbian-config characters are OK but they are wrong in Midnight Commander and vice versa - when I set UTF-8 then characters in armbian-config are wrong but in Midnight Commader are OK.
  • Mr. Beeblebrox
    Mr. Beeblebrox almost 3 years
    THIS is the real answer. If you have it set as UTF8, vt100 line draw does NOT WORK.
  • BrentHarsh
    BrentHarsh about 2 years
    UTF-8 was set for me as well, but it didn't work when I was using "pm2 monit" which updates the screen continuously. Setting "use font encoding" instead fixed that process so I was happy for a few mins. But later on, I used the "pm2 status" command which draws a box on-screen only once... and it was now displaying the garbage characters instead of lines. It's like you can't have both working at the same time. No problem with a plain-old-linux shell terminal though.