Getting Midnight Commander line drawing to work with PuTTY

When using Midnight Commander with the default settings of PuTTY connected to my Ubuntu Linux machine the line drawing characters are all messed up.

After some experimentation it turns out that to fix it all you have to do is change your character set in PuTTY to UTF-8 and the problem is fixed. To do this open up the PuTTY settings and go to Window->Translation->Received data assumed to be in which character set: and change it to UTF-8.

After making this change you might have to force a redraw of the mc screen to show the new line drawing characters:

Also not that some fonts might not have the line drawing characters available. The fonts I know work is Courier New and Lucida Console. To change your font go to Window->Appearance, Font settings and click the Change button.

For reference, I was using using Midnight Commander 4.6.1 running on Ubuntu 7.10 and using PuTTY 0.59

62 thoughts on “Getting Midnight Commander line drawing to work with PuTTY

  1. Yavuz

    Oddly enough, the above fix doesn’t work for me on Arch Linux. Since the fix that did work is almost diametrically opposite, it might be an alternative starting point for others:

    In putty:
    1. Set font to Consolas under Appearance.

    2. Set encoding to ISO-8859-1 under Translation. This is weird: Arch Linux is a full UTF-8 distro, and my locale is set to en_US.UTF-8. No idea why it works; maybe mc does not really support UTF-8.

    3. Set “Use font in both ANSI and OEM modes” under Translation. This seems to ferret out the line drawing glyphs which appear to be otherwise unavailable.

    4. Set terminal-type string to “putty-256color” under Data. Not sure this is needed, but its the most specific terminal type available for putty under Arch Linux, and we might just as well use it.

    I might get bitten by the 2nd setting later on, but atm I don’t really need anything beyond normal ascii characters.

    Reply
  2. Yavuz

    I rechecked the Arch Linux package repositoty, and found an alternative mc-utf8 package that I had missed at first. This one does behave like it should: Lucida Console + UTF-8 encoding + Unicode linedrawing codes = proper lines. However, I lose my preferred Consolas font, which is annoying since it does seem to have the necessary glyphs, just not accessible in Unicode mode.

    Reply
  3. Anonymous

    While this worked for me for Midnight Commander, now the line drawing of my kernel config (‘make menuconfig’) is screwed over the same way MC was in non UTF-8 mode. :-P

    Reply
  4. Tozzano

    These settings work for me and mc.
    For my session in PuTTY:
    Terminal | Keyboard | The function Keys and Keypad : Linux
    Window | Translation | Received data assumed to be in which character set : ISO-8859-1(Latin-1)
    Connection | Data | Terminal-type String : xterm-color

    Line Drawing, Color, and the mouse works too :)

    Reply
    1. Lukaz

      Many thanks Tozzano, Your’s HOW-TO one works the best. No I have colors in Putty na mc draws nice lines

      Reply
  5. Daze

    For ArchLinux users, if you install the package mc-mp that takes care of the line drawing issues without the need for changing PuTTY settings. Not sure why. But it works.

    Reply
  6. sean

    awesome, I don’t know how many times that I’ve been faced with that mess, I should have looked a lot sooner :-) .
    Thanks for taking the time to post that

    Reply
  7. blaxthos

    The fix didn’t work for me, but here’s what I found does work:

    APPEARANCE section
    * Use the TERMINAL font

    TRANSLATION setion
    * “Use font encoding” instead of “UTF 8″ above
    * Use font in both ANSI and OEM modes
    * Profit!

    Reply
  8. blaxthos

    Once you’ve made the changes, go back to the SESSION menu (very top of the tree) and save it as default or name it (to save multiple hosts for quick access)

    Reply
  9. Gorgon

    Thanks so much for this easy fix…it was driving me crazy! I’m on Arch Linux also, well PlugBox on a Seagate Dockstar to be exact.

    Reply
  10. ronnieg

    Alternatively, just install the missing locales to display the linedraw characters…

    # sudo dpkg-reconfigure locales

    Then select ISO-8859-1 as well as UTF-8.

    Reply
  11. Pingback: Why does Midnight Commander look crap in SSH clients?

  12. Thom

    I didn’t think this was working for me but it turns out you need to apply the settings before opening the session. It won’t work if you choose the “Change Settings…” option in the terminal menu.
    I’m using the new Consolas font in Windows 7 and it looks great

    Thanks

    Reply
  13. wahyaohni

    omg thanks, I’ve been having this problem for years until I decided to fix it for the hell and this works like a charm. I think I’m going to stare to the clean MC windows for and hour blessed by how nice it is ;-)

    Reply
  14. randomperson

    On OpenSuSE 11.4 setting PuTTY to UTF-8 fixed MC but broke Yast and several others that used line drawing. The fix was to edit language settings and de-select UTF-8 encoding. On PuTTY leave translation set to ISO-8859-1. You have to close your session and reopen before it will take effect.

    Reply
  15. ikz

    I had this same problem, but I fixed it differently. Server is running UTF-8 and so is my putty client, but when I run MC through the terminal access, the lines are screwed up.

    I noticed that the lines we’re scrambled in a different way in the screenshot compared to my terminal, so I changed the font to courier new 10-point regular and everything was dandy! And no restart required either!

    With consolas font the lines we’re wrong. In another words, the translation was fine, but the font set didn’t have the required characters (which is surprising).

    Reply
  16. Taurine

    Thank you. Works for me. Though I would like to add that it might be a good idea to save your new setting by saving it as part of a session. My 2 cents

    Reply
  17. Sandy McClintock

    Thanks. I needed to quit and restart ‘mc’
    What a useful combination! Thanks to both the Putty and mc teams.

    Reply
  18. Rafa

    Thanks for the “mc -a” tip.

    It works for web-based terminal applet, for example as I’m doing to connect to a vpn protected environment: it doesn’t have any configuration possibility, so everything you have available is the remote system , and “mc -a” uses regular ASCII characters as hyphen, bars and plus to draw lines.
    Not as good looking as graphic characters , but good enough.

    Again, thanks!

    Reply
  19. giny8i8

    Made my day, thank you. :)
    Solved my display issue.

    The funny thing is, that i use the same Putty setup for ages, but after upgrading to Debian Squezee this problem presented itself… I do not really get the connection, but it is fixed finally :)
    Thanks again.

    Reply
  20. Pingback: Midnight commander (mc) shows garbled text characters instead of graphics

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>