Midnight Commander and weird lines on CentOS/RedHat
#85 Henry, Tuesday, 15 March 2011 10:01 AM (Category: UNIX Tools)
(Tags: mc midnight commander centos)

I use Midnight Commander a lot, especially on production systems at work. If I want to delete a bunch of files or copy them or move them, then I opt for complete safety and visual cues and I use Midnight Commander. I wish it were XTree, but that is ancient history. Midnight Commander works really well for me. I know enough to be useful, but not enough to be expert. I should learn more. It works beautifully almost everywhere at work, on Slackware and many different versions of Solaris.

But there is one server at work that it looks really ugly on. It's a CentOS box, and it used to be a RedHat box, and Midnight Commander looked ugly on both. On most OSes, the Midnight Commander border lines are shown with the nice pretty graphic line characters. On CentOS/Redhat, the lines are displayed using the "a with a circumflex on top" character.

Ugly version of Midnight Commander

I've put up with this for three years but today it bugged me enough to look for a fix. I tried a lot of things on my own, and failed. Even "mc -a" had no effect. So I turned to Google, and found a lot of people asking about the same thing. I did find a fix for it, that works for my specific case. It might work for others.

It's in the environment settings. The default value on CentOS and RedHat in my case for LANG was


I changed this to be:


and Midnight Commander shows the nice pretty line drawing characters in the border.

Good version of Midnight Commander

I added this line

export LANG=en_US

to my .bash_profile so the change is permanent. I did not futz with any settings in /etc, as they could be wiped or reset by the other sysadmins. I prefer to put settings like this in my local settings so they can be preserved and only affect my usage, just in case it's needed by the system for some other purpose. I go for minimal changes to a system, and keep them local.

My problem is that I have a fix, but I don't know why it works or what is happening. I hate that. I really need to know exactly what is happening, otherwise it's just magic and smoke and mirrors and I am just a monkey-see, monkey-do type of computer operator. I'm going to research this.