Linux下中文man帮助安装。

wget http://manpages-zh.googlecode.com/files/manpages-zh-1.5.1.tar.gz
tar zxvf manpages-zh-1.5.1.tar.gz
cd manpages-zh-1.5.1
./configure
make && make install

 

测试中文是否正常
man ls
如果看到中文,可以不用进行以下步骤了!如果中文乱码,请见查当前环境 LC*设置是否正确,检查在当前终端窗口的编码是否与LC*相符如果不相符,请同意改成zh_CN.UTF-8,如果相符,按照如下步骤修改

修改 /etc/man.config文件

替换
NROFF /usr/bin/nroff -c –legacy NROFF_OLD_CHARSET -mandoc 2>/dev/null
修改为

NROFF      /usr/bin/groff -Tutf8i -mandoc

 

找了N多的资料,最后找到了这篇文章,解决了最大的问题!

Fix UTF8 characters displaying in Linux man pages
Posted October 14th, 2008 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 -mandocNROFF      /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  #注册这行 将-Tascii改为 -Tutf8就ok了
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!

下面的帖子也可以解决这个问题:

http://forums.gentoo.org/viewtopic-t-392980-start-0-postdays-0-postorder-asc-highlight-.html?sid=220ba38c3151c04c98fc64a66615a901

http://hi.baidu.com/c00lm4n/blog/item/7a33e62b52106691033bf62a.html

posted on 2012-12-06 23:30  DieAngel  阅读(407)  评论(0编辑  收藏  举报

导航