path: root/dh_installman
diff options
authorColin Watson <>2008-01-28 16:31:35 -0500
committerJoey Hess <>2008-01-28 16:31:35 -0500
commit59f291d4e7b4beb27a3a2fc18c6551920c183e26 (patch)
tree928a5d99510b3ab8b876303c8e744eaa5f597f88 /dh_installman
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.
Diffstat (limited to 'dh_installman')
1 files changed, 17 insertions, 5 deletions
diff --git a/dh_installman b/dh_installman
index 2ce0e37..55c5737 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.