Hello,

Since there may be a version of LFS that supports UTF-8 and other multibyte encodings in the future, that version has to provide the "man" program that can display manual pages in UTF-8 locales. However, man-1.x and groff-1.19.x suck. See below.

The solution is either to apply two workarounds below, or (better) switch to Debian-patched groff-1.18.1.1 (for -Tnippon and -Tascii8 devices) and Debian-patched man-db (it automagically uses the proper device and trailing iconv pipe if needed). This also means addition of db or gdbm to the book because man-db depends on one of those two database packages. Please vote if we should go with man-db or with the workarounds below.

1) The book currently provides "-lang en" as a part of man ./configure string. Readers will see that "man --help" produces this line:

Cannot open the message catalog "man" for locale "de_DE.UTF-8"
(NLSPATH="<none>")

Some readers will add something like -lang en,de (or even -lang all) to work around that and then will get an installation that displays unreadable squares instead of readable accented letters in de_DE.UTF-8 locale (de_DE.ISO-8859-1 works fine). Worse, in ru_RU.UTF-8 the entire output of man --help is a sequence of unreadable squares!

The reason is that man still uses the old "catgets" translation mechanism instaed of "gettext" and thus doesn't preform recoding from translator's charset to the user's one.

Solution: explain the problem (previous sentence) and add "+lang none" to man's ./configure line. Then, man will always display its help text and error messages in English, and will never complain about missing message catalogs.

2) The default groff setup produces pages full of garbage in UTF-8 locales instead of translated manuals (this also happened in RedHat Linux 8).

Proper groff setup is cumbersome and will take a lot of space in the book text. It must be noted that, among many possible setups implemented by distros, the one most compatible with BLFS and beyond-BLFS packages is chosen. In the approach below, BLFS instructions just produce working manual pages. For other possible setups, it is needed to add instructions for recoding translated manual pages to each BLFS package, and that is not possible due to BLFS size.

Decision tree for the proper NROFF line in /etc/man.conf is below, explanation is in the man-i18n hint:

I) if the manual pages for your locale (as supplied with source packages like shadow) are not stored in ISO-8859-1, goto III

II) NROFF /usr/bin/nroff -mandoc
(note the missing -Tlatin1) and you can view manual pages in both C, your_locale and your_locale.UTF-8. Done, and you are lucky.

III) If your locale is a Japanese or Korean one, go away. LFS doesn't provide you with working groff. man-1.x assumes Debian-patched groff here because of -Tnippon. Or, be sure to delete all Japanese and Korean manual pages, and English ones will be presented to you instead.

IV) NROFF /usr/bin/nroff -Tlatin -mandoc | /usr/bin/iconv -f OLDCHARSET

where OLDCHARSET is the charset in which manual pages for your language are stored on disk (i.e. KOI8-R should be written instead of OLDCHARSET for viewing Russian manual pages). Yes, this is a gross hack. Here groff is fooled into thinking that the manual page and the output are in ISO-8859-1 (so that no conversions take place in groff), and the trailing iconv pipe converts from the translator's charset to the user's one. It is a no-op in non-UTF-8 locales where those two are in fact the same.

--
Alexander E. Patrakov
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to