This page looks best with JavaScript enabled

Fixing Strange characters in Midnight Commander

 ·  ☕ 1 min read

Background

When using mrxvt to use midnight commander (mc) I found most of mc had odd characters (see here for an example). The issue seems to be the UTF-8 character set issue with mrxvt (actually it is multi-byte character sets in general as I understand it).

The solution is rather simple, change your locale before launching mc.

Details

I create a script (~/bin/mymc that sets the LANG to en_US.ISO-8859-1 and then launches mc:

#!/bin/bash
export LANG=en_US.ISO-8859-1
exec mc

Now all you need to do is run mymc to launch midnight commander and you should not have any odd characters.

If you do not happen to have the ISO-8859-1 character set enabled or would like to check you can by doing the following:

  • In /etc/local.gen, ensure “en_US ISO-8859-1” is not commented out
  • If it is commented out, uncomment it and then generate the locale with: $ locale-gen

Notes

If you want to script mc in mrxvt (or your terminal of choice) you can do so with the following:

mrxvt -sb -ht -g 100x30+665_330 +showmenu -title mc -e mymc

The above sets the geometry (size of the window), show menu, sets a title and finally -e executes the mymc script from above.

Share on

drad
WRITTEN BY
drad
Sr. Consultant