Thursday, April 16, 2009

SSH: Strange characters in Midnight Commander

If one tries to login into a linux box using SSH and gets strange characters instead of lines in Midnight Commander (MC), one can try to set an environmental variable LC_ALL to C:export LC_ALL=CFor me, it transformed MC from this: to this: Although there are still some strange characters for scrolls, MC looks considerably better.

The above command can be written in your local .bash_profile file, that you don't have to set it manually every time you login.

Command local can be used to check the state your local character encoding variables. For example [w@localhost rpms]$ locale
LANG=en_US.UTF-8
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C

7 comments:

  1. Anonymous12:37 AM

    much better, thanks!

    ReplyDelete
  2. To completely get rid of the odd characters you should set your LANG environment variable to en_US.ISO-8859-1. See the following article for an example: http://www.adercon.com/ac/node/69

    ReplyDelete
  3. Anonymous2:31 PM

    I had a similar issue using mc in Putty over SSH. Solution was to change the character encoding of Putty (Window->Translations->Remote character set) to UTF-8.

    ReplyDelete
  4. Anonymous5:02 AM

    Solved it for me too.

    ReplyDelete