diff options
authorColin Watson <>2008-01-28 16:31:35 -0500
committerJoey Hess <>2008-01-28 16:31:35 -0500
commit59f291d4e7b4beb27a3a2fc18c6551920c183e26 (patch)
parentee304dd6bc7a476e250f413287008dbfe666b5a5 (diff)
recode manual pages to UTF-8
I uploaded man-db 2.5.1-1 to incoming this morning, so I think we can now proceed with the plan we discussed a while back: I've attached a patch against git HEAD that recodes all manual pages to UTF-8 on installation. I've tested this with debconf and it seems to be doing the right thing. I suspect a small number of packages that have inconsistently-encoded manual pages will fail to build as a result of this, but I believe that these are rather few and I contend that they were buggy anyway (as man would fail to display those pages). The reason for the slightly baroque installation method (install file, man --recode to .new, mv back) is that this allows man to guess the encoding based on the installation directory. Note that the original (non-.UTF-8) installation directories are retained, per the latest discussion in #440420.
2 files changed, 18 insertions, 6 deletions
diff --git a/debian/control b/debian/control
index 1b707b27..1a8ffe88 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Homepage:
Package: debhelper
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23-1), dpkg-dev (>= 1.14.15), html2text, binutils, po-debconf
+Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23-1), dpkg-dev (>= 1.14.15), html2text, binutils, po-debconf, man-db (>= 2.5.1-1)
Suggests: dh-make
Conflicts: dpkg-cross (<< 1.18), python-support (<< 0.5.3), python-central (<< 0.5.6)
Description: helper programs for debian/rules
diff --git a/dh_installman b/dh_installman
index 2ce0e377..55c57370 100755
--- a/dh_installman
+++ b/dh_installman
@@ -38,6 +38,11 @@ like /usr/share/man/pl/man1/, that is because your program has a
name like "", and dh_installman assumes that means it is translated
into Polish. Use --language=C to avoid this.
+dh_installman will use man to guess the character encoding of each manual
+page and convert it to UTF-8. If the guesswork fails for some reason, you
+can override it using an encoding declaration. See L<manconv(1)> for
Any man page filenames specified as parameters will be installed into the
first package dh_installman is told to act on. By default, this is the
first binary package in debian/control, but if you use -p, -i, or -a flags,
@@ -162,16 +167,23 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
$destdir=~tr:/:/:s; # just for looks
+ my $instpage="$destdir/$instname.$section";
- next if -l "$destdir/$instname.$section";
- next if compat(5) && -e "$destdir/$instname.$section";
+ next if -l $instpage;
+ next if compat(5) && -e $instpage;
if (! -d $destdir) {
doit "install","-d",$destdir;
- doit "install","-p","-m644",$page,
- "$destdir$instname.$section$gz";
+ if ($gz) {
+ complex_doit "zcat \Q$page\E > \Q$instpage\E";
+ }
+ else {
+ doit "install","-p","-m644",$page,$instpage;
+ }
+ complex_doit "man --recode UTF-8 \Q$instpage\E > \Q$\E";
+ doit "chmod",644,"$";
+ doit "mv","$",$instpage;
# Now the .so conversion.