2 | | |
3 | | == UTF-8 support == |
4 | | |
5 | | 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. |
6 | | |
7 | | 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. |
8 | | |
9 | | After unpacking the archive, apply the Debian patch: |
10 | | {{{ |
11 | | zcat ../mc_4.6.1-6.diff.gz | patch -Np1 |
12 | | }}} |
13 | | |
14 | | 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: |
15 | | {{{ |
16 | | rm debian/patches/01_mc.ext.in.mime.patch |
17 | | rm debian/patches/02_debian_syntax.patch |
18 | | rm debian/patches/08_awk.patch |
19 | | rm debian/patches/36_developer_mode.patch |
20 | | }}} |
21 | | |
22 | | Apply the other patches: |
23 | | {{{ |
24 | | for a in debian/patches/*.patch ; do \ |
25 | | echo $a ; patch --force -Np1 -i $a || patch -Np0 -i $a ; \ |
26 | | done |
27 | | }}} |
28 | | |
29 | | Prepare MC for compilation: |
30 | | {{{ |
31 | | CPPFLAGS="-DUTF8" ./configure --with-screen=slang --prefix=/usr |
32 | | }}} |
33 | | |
34 | | 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. |
35 | | |
36 | | 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: |
37 | | |
38 | | {{{ |
39 | | iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint > tmp && mv tmp lib/mc.hint |
40 | | iconv -f ISO-8859-1 -t UTF-8 doc/xnc.hlp > tmp && mv tmp doc/xnc.hlp |
41 | | iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint.es > tmp && mv tmp lib/mc.hint.es |
42 | | iconv -f ISO-8859-1 -t UTF-8 doc/es/xnc.hlp > tmp && mv tmp doc/es/xnc.hlp |
43 | | iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint.it > tmp && mv tmp lib/mc.hint.it |
44 | | iconv -f ISO-8859-1 -t UTF-8 doc/it/xnc.hlp > tmp && mv tmp doc/it/xnc.hlp |
45 | | iconv -f ISO-8859-1 -t UTF-8 lib/mc.hint.nl > tmp && mv tmp lib/mc.hint.nl |
46 | | iconv -f ISO-8859-2 -t UTF-8 lib/mc.hint.cs > tmp && mv tmp lib/mc.hint.cs |
47 | | iconv -f ISO-8859-2 -t UTF-8 lib/mc.hint.hu > tmp && mv tmp lib/mc.hint.hu |
48 | | iconv -f ISO-8859-2 -t UTF-8 doc/hu/xnc.hlp > tmp && mv tmp doc/hu/xnc.hlp |
49 | | iconv -f ISO-8859-2 -t UTF-8 lib/mc.hint.pl > tmp && mv tmp lib/mc.hint.pl |
50 | | iconv -f ISO-8859-2 -t UTF-8 doc/pl/xnc.hlp > tmp && mv tmp doc/pl/xnc.hlp |
51 | | iconv -f ISO-8859-5 -t UTF-8 lib/mc.hint.sr > tmp && mv tmp lib/mc.hint.sr |
52 | | iconv -f ISO-8859-5 -t UTF-8 doc/sr/xnc.hlp > tmp && mv tmp doc/sr/xnc.hlp |
53 | | iconv -f ISO-8859-5 -t UTF-8 lib/mc.menu.sr > tmp && mv tmp lib/mc.menu.sr |
54 | | iconv -f koi8-r -t UTF-8 lib/mc.hint.ru > tmp && mv tmp lib/mc.hint.ru |
55 | | iconv -f koi8-r -t UTF-8 doc/ru/xnc.hlp > tmp && mv tmp doc/ru/xnc.hlp |
56 | | iconv -f koi8-u -t UTF-8 lib/mc.hint.uk > tmp && mv tmp lib/mc.hint.uk |
57 | | iconv -f big5 -t UTF-8 lib/mc.hint.zh > tmp && mv tmp lib/mc.hint.zh |
58 | | }}} |
59 | | |
60 | | This conversion is necessary even for non-UTF-8 locales, because patched MC converts it from UTF-8 to the locale charset. |
61 | | |
62 | | Now compile the package: |
63 | | {{{ |
64 | | make |
65 | | }}} |
66 | | |
67 | | And, as root, install it: |
68 | | {{{ |
69 | | make install |
70 | | }}} |
71 | | |
72 | | == Subshell/Glibc/Locale == |
73 | | |
74 | | 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; |
75 | | |
76 | | {{{ |
77 | | sed -i "s|isalpha|\!isdigit|" src/subshell.c |
78 | | }}} |
79 | | |
80 | | Of course, you should apply this change just after unpacking and changing to the source directory. |
81 | | |
82 | | (This is a duplicate of http://www.nabble.com/-bug--18136--MC-wont-work-with-new-bash-3.2-propeply-with-all-directories.-t2528281.html, and the fix above is not right -- Alexander E. Patrakov) |