Fix UTF8 characters displaying in Linux man pages

Posted in Linux/Unix/BSD -

Man pages on Linux and other *NIX operating systems document how commands work. I've often noticed in a default install on Red Hat based distros that odd UTF characters display such as  and â and these can obscure the meaning of the information in the manpage. This post looks at how to make these weird UTF8 characters display normally in Linux manpages.

I had this issue on a CentOS 5 machine so the issue and instructions presented here will be the same for Red Hat Enterprise Linux 5. I can aso confirm they work for Red Hat Enterprise 4 as I have implemented the change here on a RHEL4 machine as well. It may also work on older versions and other distros that have the issue.

A sample section of a man page showing the odd UTF8 characters, from the mysqldump manpage, is as follows:

·  --where=âwhere_conditionâ, -w âwhere_conditionâ

To fix the problem open up the /etc/man.config as root or using sudo. For example using nano, you would do this:

sudo nano /etc/man.config

Locate the section that looks like this:

# Useful paths - note that COL should not be defined when
# NROFF is defined as "groff -Tascii" or "groff -Tlatin1";
# not only is it superfluous, but it actually damages the output.
# For use with utf-8, NROFF should be "nroff -mandoc" without -T option.
# (Maybe - but today I need -Tlatin1 to prevent double conversion to utf8.)
# If you have a new troff (version 1.18.1?) and its colored output
# causes problems, add the -c option to TROFF, NROFF.
TROFF       /usr/bin/groff -Tps -mandoc
NROFF      /usr/bin/nroff -c --legacy NROFF_OLD_CHARSET -mandoc 2>/dev/null

and change the NROFFF line to this:

NROFF      /usr/bin/groff -Tascii -mandoc

Save the file and exit.

The section of the mysqldump manpage that was used above will now look like this:

o  --where='where_condition', -w 'where_condition'

 Much better!