Version 11 (modified by 16 years ago) ( diff ) | ,
---|
MC
UTF-8 support
MC does not support UTF-8 out of the box. The problem manifests itself as misaligned characters on the screen and impossibility to view/edit files containing non-ASCII characters in UTF-8 based locales. Distros apply patches in order to improve the situation, but bugs are still being reported.
The following instructions use the Debian patch in order to compile UTF-8 aware Midnight Commander. The patch can be downloaded from http://ftp.debian.org/debian/pool/main/m/mc/mc_4.6.1-6.diff.gz. S-Lang-2.0.6 becomes a required dependency.
After unpacking the archive, apply the Debian patch:
zcat ../mc_4.6.1-6.diff.gz | patch -Np1
This patch only extracts Debian-specific files (including patches) in the debian directory. Remove patches that don't have to be applied on a non-Debian system:
rm debian/patches/01_mc.ext.in.mime.patch rm debian/patches/02_debian_syntax.patch rm debian/patches/08_awk.patch rm debian/patches/36_developer_mode.patch
Apply the other patches:
for a in debian/patches/*.patch ; do \ echo $a ; patch --force -Np1 -i $a || patch -Np0 -i $a ; \ done
Prepare MC for compilation:
CPPFLAGS="-DUTF8" ./configure --with-screen=slang --prefix=/usr
The CPPFLAGS="-DUTF8" and --with-screen=slang options are mandatory for the UTF-8 patch to take effect. You may add your own extra options.
Since the patch changes the way how MC handles the documentation, it has to be converted to UTF-8 in order to be correctly displayed:
iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint > tmp && mv tmp lib/mc.hint iconv -f ISO-8859-1 -t UTF-8 doc/xnc.hlp > tmp && mv tmp doc/xnc.hlp iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint.es > tmp && mv tmp lib/mc.hint.es iconv -f ISO-8859-1 -t UTF-8 doc/es/xnc.hlp > tmp && mv tmp doc/es/xnc.hlp iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint.it > tmp && mv tmp lib/mc.hint.it iconv -f ISO-8859-1 -t UTF-8 doc/it/xnc.hlp > tmp && mv tmp doc/it/xnc.hlp iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint.nl > tmp && mv tmp lib/mc.hint.nl iconv -f ISO-8859-2 -t UTF-8 lib/mc.hint.cs > tmp && mv tmp lib/mc.hint.cs iconv -f ISO-8859-2 -t UTF-8 lib/mc.hint.hu > tmp && mv tmp lib/mc.hint.hu iconv -f ISO-8859-2 -t UTF-8 doc/hu/xnc.hlp > tmp && mv tmp doc/hu/xnc.hlp iconv -f ISO-8859-2 -t UTF-8 lib/mc.hint.pl > tmp && mv tmp lib/mc.hint.pl iconv -f ISO-8859-2 -t UTF-8 doc/pl/xnc.hlp > tmp && mv tmp doc/pl/xnc.hlp iconv -f ISO-8859-5 -t UTF-8 lib/mc.hint.sr > tmp && mv tmp lib/mc.hint.sr iconv -f ISO-8859-5 -t UTF-8 doc/sr/xnc.hlp > tmp && mv tmp doc/sr/xnc.hlp iconv -f ISO-8859-5 -t UTF-8 lib/mc.menu.sr > tmp && mv tmp lib/mc.menu.sr iconv -f koi8-r -t UTF-8 lib/mc.hint.ru > tmp && mv tmp lib/mc.hint.ru iconv -f koi8-r -t UTF-8 doc/ru/xnc.hlp > tmp && mv tmp doc/ru/xnc.hlp iconv -f koi8-u -t UTF-8 lib/mc.hint.uk > tmp && mv tmp lib/mc.hint.uk iconv -f big5 -t UTF-8 lib/mc.hint.zh > tmp && mv tmp lib/mc.hint.zh
This conversion is necessary even for non-UTF-8 locales, because patched MC converts it from UTF-8 to the locale charset.
Now compile the package:
make
And, as root, install it:
make install
Subshell/Glibc/Locale
There seems to be a breakage on the newer glibc (I am using 2.5 from CLFS development) and some of the locales. Specifically, function isalpha() renders different result for the subshell change directory function in the Midnight Commander. MC does change directory in the panel but not in the subshell and writes: "Warning: Cannot change to directory ...". I am not sure about tcsh or zsh, but this stomps the bug using bash as shell;
sed -i "s|isalpha|\!isdigit|" src/subshell.c
Of course, you should apply this change just after unpacking and changing to the source directory.
(I can't confirm this with or without the Debian patch, and the "fix" looks strange. This section will be deleted if no step-by-step instructions to reproduce the bug appear before 2007-02-15 -- Alexander E. Patrakov)