搜尋此網誌

2012年6月19日 星期二

[FreeBSD] 在shell的命令列下直接打中文


> 在ssh登入後, 可以看中文, 也可以在editor裡打中文,
> 但就是在command line下不能打中文
 
http://www.csie.nctu.edu.tw/~chlo/web/docs/doc/data/freebsd/12.htm
 
[for bash]
在~/.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


[for tcsh]
在 ~/.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] 而設定的。