LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 4876|回复: 22

中文man乱码问题解决办法

[复制链接]
发表于 2007-11-24 17:28:05 | 显示全部楼层 |阅读模式
搜索了论坛中的老帖子,原因在于groff对UTF8的处理有问题。但是多是建议不安装man-pages-zh_CN直接看英文,不能显示中文的本质问题还是没有解决。

groff-utf8 提供了一个让groff间接支持UTF8的办法。

使用下面的ebuild(参考别人的做了点修改),最后按照后面的提示,修改 /etc/man.conf

/usr/local/portage/app-text/groff-utf8
  1. # Copyright 1999-2006 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $

  4. DESCRIPTION="GNU groff wrapper allowing UTF-8 input"
  5. HOMEPAGE="http://www.haible.de/bruno/packages-groff-utf8.html"
  6. SRC_URI="http://www.haible.de/bruno/gnu/${PN}.tar.gz"

  7. LICENSE="GPL-2"
  8. SLOT="0"
  9. KEYWORDS="x86 amd64"
  10. IUSE=""

  11. DEPEND=">=sys-apps/groff-1.18.1"

  12. S="${WORKDIR}/${PN}"

  13. src_install() {
  14.         make install DESTDIR=${D} PREFIX=/usr || die "make install failed"
  15. }

  16. pkg_postinst() {
  17.         elog "Sample use:"
  18.         elog "$ groff-utf8 -Tutf8 -mandoc find.vi.1 | less"
  19.         elog "$ groff-utf8 -Thtml -mandoc find.vi.1 > find.html; mozilla find.html"
  20.         elog
  21.         elog "You can also in /etc/man.conf edit the definitions of the"
  22.         elog "variables troff and nroff, to use groff-utf8 instead of groff."
  23.         elog "For example:"
  24.         elog "NROFF       /usr/bin/groff-utf8 -Tutf8 -c -mandoc"
  25.         elog
  26.         elog "Of course this is only a stopgap measure, until groff can process"
  27.         elog "UTF-8 encoded man pages by itself, sometime in the future. "
  28. }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2007-11-24 18:11:17 | 显示全部楼层
等我把它放到gentoo-china overlay
回复 支持 反对

使用道具 举报

发表于 2007-11-24 18:32:25 | 显示全部楼层
我稍微修改了一下
  1. # Copyright 1999-2007 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $
  4. DESCRIPTION="GNU groff wrapper allowing UTF-8 input"
  5. HOMEPAGE="http://www.haible.de/bruno/packages-groff-utf8.html"
  6. SRC_URI="http://www.haible.de/bruno/gnu/${PN}.tar.gz"
  7. LICENSE="GPL-2"
  8. SLOT="0"
  9. KEYWORDS="x86 amd64"
  10. IUSE=""
  11. RESTRICT="mirror"
  12. DEPEND=">=sys-apps/groff-1.18.1"
  13. S="${WORKDIR}/${PN}"
  14. src_install() {
  15.         emake install DESTDIR="${D}" PREFIX=/usr || die "make install failed"
  16. }
  17. pkg_postinst() {
  18.         elog "Sample usage:"
  19.         elog "$ groff-utf8 -Tutf8 -mandoc find.vi.1 | less"
  20.         elog "$ groff-utf8 -Thtml -mandoc find.vi.1 > find.html; mozilla find.html"
  21.         elog
  22.         elog "You can also modify the TROFF/NROFF settings in your /etc/man.conf"
  23.         elog "to make it use groff-utf8 instead of groff."
  24.         elog "For example:"
  25.         elog "NROFF       /usr/bin/groff-utf8 -Tutf8 -c -mandoc"
  26.         elog
  27.         elog "The whole idea is only a workaround. The ideal solution is to merge"
  28.         elog "this package with groff, maybe sometime in the future. "
  29. }
复制代码
回复 支持 反对

使用道具 举报

发表于 2007-11-24 19:01:45 | 显示全部楼层
太好了,不用老是对着英文发愣了,哈哈
回复 支持 反对

使用道具 举报

发表于 2007-11-24 22:23:26 | 显示全部楼层
为何不直接提交bug 报告上去,从源开始修正了?
回复 支持 反对

使用道具 举报

发表于 2007-11-24 22:38:42 | 显示全部楼层
you know that we are not the author of the package itself. We'd better leave this task to the author himself.
回复 支持 反对

使用道具 举报

发表于 2007-11-25 13:05:05 | 显示全部楼层
按要求设置了,怎么还是看到不中文版的man?
回复 支持 反对

使用道具 举报

发表于 2007-11-25 16:51:07 | 显示全部楼层
装了中文man page没有
回复 支持 反对

使用道具 举报

发表于 2007-11-25 16:58:40 | 显示全部楼层
用不来....
回复 支持 反对

使用道具 举报

发表于 2007-11-25 18:10:46 | 显示全部楼层

安装了!

Post by zhllg;1787493
装了中文man page没有

指的是不是:
emerge -av man-pages-zh_CN

这个我已经正确安装了!
(LC_ALL=zh_CN.UTF-8)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表