Midnight commander (mc) is missing UTF-8 support

It seems the default Midnight Commander (mc) package (package version 4.8.20-2) doesn’t support UTF-8 correctly. This is problematic when Turris hosts a Samba server with lots of files that doesn’t display correctly.

The relevant settings in mc are set correctly:

  • “Options” -> “Display bits” are set correctly to “UTF-8” with “Full 8 bits input” checkbox enabled,
  • Panel “Encoding” is correctly set to “No translation”).

UTF-8 seems works fine on the command line. Steps to reproduce:

  1. run bash (ash doesn’t seem to support UTF-8 according to info on openwrt forum) and create a file with some non-ascii characters

root@turris:/tmp# bash
root@turris:/tmp# echo $0
bash
root@turris:/tmp# touch “Příliš žluťoučký kůň úpěl ďábelské ódy”
root@turris:/tmp# ls Př*
Příliš žluťoučký kůň úpěl ďábelské ódy

  1. run mc and check how the fle looks. It displays as “PM-E~YM-CM–liM-EM …”.
    However, when selected, copied by “Alt + Enter” to mc’s command line as parameter to echo command, it’s displayed correctly when “Ctrl + o” is pressed to see the output.

The file also displays correctly in mc running in LXC contaner under Debian 9.

The only openwrt related topic I’ve found is https://forum.archive.openwrt.org/viewtopic.php?id=68106 (Midnight Commander doesn’t display UTF-8 correctly) that suggests recompiling mc from the scratch, but for a commercial product, the package should really support UTF-8 out of the box.

By me

image

Happens also with mcedit "Příliš žluťoučký kůň úpěl ďábelské ódy"

Perhaps this been a bug that since has been fixed at its master development but not yet ported back into the current package at OpenWRT/TOS.

As a workaround, since I added an internal mSATA SSD to my Turris to use LXC containers, I’m running all services I can (Samba, DLNA server, git repositories hosting etc.) from the LXC container with Debian, which is much more user firendly and contains much more software. Since mc in Debian 9 displays UTF-8 without problems, my problem is solved.

This does not happen with recent Turris OS releases. Tested it on Turris OS 5.3.2.