在完成中文系統建立的工作,您已經可以在您的 FreeBSD 機器上面顯示中文了。但如果您使用 Shell,您會發現, 您的 FreeBSD 只能顯示中文,卻無法接受中文的輸入工作。 如果您想要改進這個問題,您必須自己修改一些設定,使 FreeBSD 系統可以接受中文的輸出與輸入工作。
您必須要在您使用的 Shell 起始檔增加 locale 的設定。 (如果您的家目錄中並未有這樣的檔案,請自行建立)
Bash Shell:
在 ~/.profile 或 ~/.bashrc 增加下面的內容:
#stty cs8 -istrip #stty pass8 export LANG=zh_TW.Big5 export LC_CTYPE=zh_TW.Big5
另外在 ~/.inputrc 檔增加設定如下:
# inputrc - global inputrc for libreadline # See readline(3readline) and `info rluserman' for more information. # Be 8 bit clean. set meta-flag on set input-meta on set output-meta on # To allow the use of 8bit-characters like the german umlauts, comment out # the line below. However this makes the meta key not work as a meta key, # which is annoying to those which don't need to type in 8-bit characters. set convert-meta off
Tcsh Shell:
在 ~/.login 或 ~/.cshrc 增加設定如下:
#stty cs8 -istrip #stty pass8 setenv LANG zh_TW.Big5 setenv LC_CTYPE zh_TW.Big5 set dspmbyte=" 0000000000000000000000000000000000000000000000000000000000000000 2222222222222222222222222222222222222222222222222222222222222220 2333333333333333333333333333333333333333333333333333333333333333 3333333333333333333333333333333333333333333333333333333333333330"
請將 dspmbyte 在 "" 中的字串接起來。
關於 dspmtype 設定的原因是因為在 tcsh 的 man page 中,對照 Big5 的使用字碼表 [\x81-\xFE][\x40-\x7E\x80-\xFE] 而設定的。
tcsh-6.11 內建了中文 big5 支援
dspmbyte (+) If set to `euc', it enables display and editing EUC-kanji(Japanese) code. If set to `sjis', it enables display and editing Shift-JIS(Japanese) code. If set to `big5', it enables display and editing Big5(Chinese) code. If set to the follow ing format, it enables display and editing of original multi-byte code format:
所以以後 dspmbyte 設定成 big5,不用設定一大串; 或者乾脆不要設定 dspmbyte,只要 LANG 為 zh_TW.Big5 就可以了 :)
2001/09/05 -CURRENT 匯入 tcsh-6.11 2001/10/08 -STABLE 匯入 tcsh-6.11 http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/tcsh/Fixes
如果是簡體環境,由於 csh/tcsh 並沒有包含自動偵測簡體環境的部分, 可以參考 big5 的做法修改 tc.const.c, 或是設定 set dspmbyte=euc 就可以了。