Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
中文手册乱码
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index 中文 (Chinese)
View previous topic :: View next topic  
Author Message
bigmonk
n00b
n00b


Joined: 16 Nov 2004
Posts: 47
Location: china

PostPosted: Wed Oct 19, 2005 3:29 am    Post subject: 中文手册乱码 Reply with quote

中文man手册乱码
如之奈何?
_________________
http://gentoogle.blogspot.com/
Back to top
View user's profile Send private message
gentoo.cn
n00b
n00b


Joined: 10 Sep 2005
Posts: 8

PostPosted: Thu Oct 20, 2005 2:31 am    Post subject: Re: 中文手册乱码 Reply with quote

bigmonk wrote:
中文man手册乱码
如之奈何?


你的locale设的是什么?
Back to top
View user's profile Send private message
bigmonk
n00b
n00b


Joined: 16 Nov 2004
Posts: 47
Location: china

PostPosted: Thu Oct 20, 2005 3:12 am    Post subject: Reply with quote

LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8
_________________
http://gentoogle.blogspot.com/
Back to top
View user's profile Send private message
akar
Bodhisattva
Bodhisattva


Joined: 03 Dec 2004
Posts: 348
Location: HKSAR,China

PostPosted: Thu Oct 20, 2005 2:52 pm    Post subject: Reply with quote

  用Gnome的 終端機的設定字元編碼可以立即修正這個問題嗎?
_________________
AKar
Back to top
View user's profile Send private message
bigmonk
n00b
n00b


Joined: 16 Nov 2004
Posts: 47
Location: china

PostPosted: Mon Oct 31, 2005 3:00 pm    Post subject: Reply with quote

解决不了,平常是能正常显示汉字的。
_________________
http://gentoogle.blogspot.com/
Back to top
View user's profile Send private message
ts
Tux's lil' helper
Tux's lil' helper


Joined: 15 Dec 2004
Posts: 97

PostPosted: Sun Nov 06, 2005 6:45 am    Post subject: Reply with quote

bigmonk wrote:
解决不了,平常是能正常显示汉字的。


不是所有的手册都有中文的,还是选择英文吧。

运行下面的命令:
Code:

echo "
export LC_ALL=""
export LANG=zh_CN.utf8
export LC_CTYPE="zh_CN.utf8"
export LC_NUMERIC="en_US.utf8"
export LC_TIME="en_US.utf8"
export LC_COLLATE="en_US.utf8"
export LC_MONETARY="en_US.utf8"
export LC_MESSAGES="en_US.utf8"
export LC_PAPER="en_US.utf8"
export LC_NAME="en_US.utf8"
export LC_ADDRESS="en_US.utf8"
export LC_TELEPHONE="en_US.utf8"
export LC_MEASUREMENT="en_US.utf8"
export LC_IDENTIFICATION="en_US.utf8"
" >> ~/.bashrc


这应该能暂时解决你的问题。Good luck!
Back to top
View user's profile Send private message
bigmonk
n00b
n00b


Joined: 16 Nov 2004
Posts: 47
Location: china

PostPosted: Fri Nov 11, 2005 2:07 am    Post subject: Reply with quote

英文手册本来就没有问题,我现在命令行下是英文的locale,x-window下是中文的,打开gnome-terminal时用man 就会是乱码。这个是应该能解决的。只是没有找到方法而已。
_________________
http://gentoogle.blogspot.com/
Back to top
View user's profile Send private message
akar
Bodhisattva
Bodhisattva


Joined: 03 Dec 2004
Posts: 348
Location: HKSAR,China

PostPosted: Fri Nov 11, 2005 4:37 am    Post subject: Reply with quote

http://pobox.com/~hp/terminal-encoding.png
_________________
AKar
Back to top
View user's profile Send private message
bigmonk
n00b
n00b


Joined: 16 Nov 2004
Posts: 47
Location: china

PostPosted: Tue Nov 22, 2005 10:32 pm    Post subject: Reply with quote

我不是不会改terminal的locale,我是问在zh_CN.utf_8下如何显示中文man,可能我没说清楚。
_________________
http://gentoogle.blogspot.com/
Back to top
View user's profile Send private message
akar
Bodhisattva
Bodhisattva


Joined: 03 Dec 2004
Posts: 348
Location: HKSAR,China

PostPosted: Fri Nov 25, 2005 12:16 am    Post subject: Reply with quote

  是這樣,嗬。

  那麻煩你告訴大家一聲是哪個程式,及其版本的man有中文亂碼問題。我來試一下,如果我也搞不懂的話,那我就再把這個問題向其它人問一下。


  希望可以盡快解決。 :)
_________________
AKar
Back to top
View user's profile Send private message
zephyrrr
n00b
n00b


Joined: 28 Aug 2005
Posts: 2

PostPosted: Tue Nov 29, 2005 1:29 am    Post subject: Reply with quote

不知道你用的是哪里的中文man,如果是CMPP(Chinese Man Pages Project)的,应该有两个内码版本,GB2312和UTF8的,要和你的locale设置一致
Back to top
View user's profile Send private message
Twig
n00b
n00b


Joined: 06 Aug 2005
Posts: 8

PostPosted: Wed Dec 07, 2005 12:49 pm    Post subject: Reply with quote

我的useradd系列命令的man和info都是乱码。
$locale
LANG=en_US.utf8
LC_CTYPE=zh_CN.UTF-8
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
Back to top
View user's profile Send private message
bigmonk
n00b
n00b


Joined: 16 Nov 2004
Posts: 47
Location: china

PostPosted: Fri Dec 09, 2005 3:16 am    Post subject: Reply with quote

应该与下面这个包有关
app-i18n/man-pages-zh_CN
Available versions: 1.5
Installed: 1.5
Homepage: http://cmpp.linuxforum.net/
Description: A somewhat comprehensive collection of Chinese Linux man pages
_________________
http://gentoogle.blogspot.com/
Back to top
View user's profile Send private message
Twig
n00b
n00b


Joined: 06 Aug 2005
Posts: 8

PostPosted: Fri Dec 09, 2005 7:14 pm    Post subject: Reply with quote

bigmonk wrote:
应该与下面这个包有关
app-i18n/man-pages-zh_CN
Available versions: 1.5
Installed: 1.5
Homepage: http://cmpp.linuxforum.net/
Description: A somewhat comprehensive collection of Chinese Linux man pages


是这个包的问题。
Back to top
View user's profile Send private message
akar
Bodhisattva
Bodhisattva


Joined: 03 Dec 2004
Posts: 348
Location: HKSAR,China

PostPosted: Fri Dec 16, 2005 4:08 am    Post subject: [教程]解決 中文man 亂碼 的問題 Reply with quote

出了問題的包
  首先介紹一下 app-i18n/man-pages-zh_CN-1.5這個包,這是man的中文翻譯版本,出自 中文man page计划,想出一分力的朋友記得去報名參加。
  好,大概了解了包的來龍,再看包內的說明文檔README,了解它的去脈。接著自己安裝出現問題的包來看看:
Code:
#emerge man-pages-zh_CN


  安裝好後,發現如果locale不是對的話,就找不到man:
Code:
# man cat

# man cat wrote:

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

No manual entry for cat


  把/usr/share/man/zh_CN.UTF-8 弄一個符號連結名為/usr/share/man/zh_TW.UTF-8
Code:

# cd /usr/share/man
# ln -s zh_CN.UTF-8 zh_TW.UTF-8


  測試一下,(亂碼。。。, 而且不是普通的亂):
Code:
# man cat


找出錯處

  好,利用man指令內建的除錯參數看一下:
Code:
 $ man -d cat

以下是man的內部指令串,把man標簽書寫的文本轉成平常我們看見的man文件的樣子 wrote:

cd /usr/share/man/zh_TW.UTF-8 && (echo ".ll 10.4i"; echo ".nr LL 10.4i"; echo ".pl 1100i"; /bin/cat '/usr/share/man/zh_TW.UTF-8/man1/cat.1'; echo ".\\\""; echo ".pl \n(nlu+10") | /usr/bin/gtbl | /usr/bin/nroff -c -mandoc | /usr/bin/less

  (看見了嗎? 小工具集合起來的威力!,這就是Unix系列系統的特色。)

  一直查下去,看看在哪一站亂碼了。最後找到,問題出在groff/nroff(runoff 印出文本)這個文件格式轉換程式:
  nroff 有 -Tutf8 的參數,但形同虚設。 不知道是不是還在用 這個補釘(為什麼外國人的所謂utf-8支援和我們的不一樣?!)

解決方法

  groff的真正utf-8版本:

  在這個 俄文網頁找到說明,在這 下載 groff-utf8.tar.gz 。 建議用以下指令完成下載及安裝:
Code:

$ wget http://lists.gnu.org/archive/html/groff/2005-07/bineYgga7Cm9p.bin -O groff-utf8.tar.gz
$ tar zxf groff-utf8.tar.gz
$ cd groff-utf8
$ sudo make install PREFIX=/usr/local

  再修改/etc/man.conf 的兩個配置,來使用新安裝的版本:
# cat /etc/man.conf wrote:

TROFF /usr/local/bin/groff-utf8 -Tutf8 -mandoc
NROFF /usr/local/bin/groff-utf8 -Tutf8 -mandoc



參考資源

http://www.gentoo.org/doc/en/utf-8.xml
http://docs.linux.org.ua/dlou/index.php/UTF-8
_________________
AKar
Back to top
View user's profile Send private message
fiag
n00b
n00b


Joined: 23 Jun 2005
Posts: 12

PostPosted: Mon Feb 13, 2006 12:41 pm    Post subject: Reply with quote

楼上的方法果然好用,谢谢~
Back to top
View user's profile Send private message
shawn_liu
n00b
n00b


Joined: 17 Mar 2012
Posts: 3

PostPosted: Sat Mar 17, 2012 3:26 pm    Post subject: Reply with quote

上面那个groff-utf8的链接已经失效了,gentoo-china-overlay上面有一个

http://code.google.com/p/gentoo-china-overlay/source/browse/trunk/metadata/cache/app-text/groff-utf8-0
Back to top
View user's profile Send private message
jtshs256
n00b
n00b


Joined: 25 Mar 2011
Posts: 17

PostPosted: Sun Mar 18, 2012 4:25 pm    Post subject: Reply with quote

emerge -C man && emerge -1 man-db
不就解決了…
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index 中文 (Chinese) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum