Table of Contents
前言
系統
需要修正的東西
轉碼表 (Big5-2003)
Locale 字寬
軟體
PuTTY
shell
luit
screen
chinese/mutt
BBS
x11/rxvt-unicode
chinese/oxim
x11/mlterm
chinese/irssi
converters/convmv
前言
我最近在把 FreeBSD 底下的環境換成 Unicode (UTF-8) 環境,底下是一些需要的設定之類的。另外,感謝 kcwu 提供許多協助跟 patches。
系統
5.x or above
Unicode Support in FreeBSD
需要修正的東西
轉碼表 (Big5-2003)
理由是因為 Unicode 那邊的 Big5 表日文對應是錯誤的,換 Big5-2003 只是因為它是標準(列在 CNS11643 新版附錄)
kcwu's Big5-2003
我把 libiconv, screen 做成 [ports
http://rafan.infor.org/patch/big5/
],不過這個版本的 screen 我有包了
mhsin 的字寬 patch
、
mhsin 的 antiidle patch
,以及
rafan 的 poorman box drawing patch
。
Locale 字寬
目前我只知道 rxvt-unicode 會用 wcwidth(3), wcswidth(3) 去看字寬,因此我參考 kcwu 的方法,暴力 patch locale 裡面的字寬
裝 chinese/big5width
vte based terminal (like gnome-terminal), 設環境變數 VTE_CJK_WIDTH (需要 vte >= 0.16.2
NEWS
)
軟體
PuTTY
把 encoding 設定成 UTF-8,”Treat CJK… as wide” 打開,box drawing characters 就是雙字寬了 (請用 PuTTY 0.58 或以上版本)
PieTTY
對 UTF8 的支援也很不錯喔,也有內建字寬修正等
shell
LANG=zh_TW.UTF-8; 很多程式會看 LANG,LC_CTYPE. 以前亂設的請拿掉.
alias b5=“LANG=zh_TW.Big5 /usr/X11R6/bin/luit”
luit
kcwu's /usr/X11R6/lib/X11/fonts/encodings/large/big5-eten-0.enc.gz
X.org 6.9 之後,似乎換了 Big5 table 會造成 ttfm 沒有辦法正常的生出 fonts.dir
screen
defc1 off
defencoding utf8
screen 會看執行 screen 時的 LANG 幫你轉
bind b encoding big5 utf8 (C-a b 切 Big5)
bind u encoding utf8 utf8 (C-a u 切 utf-8)
裝 sysutils/screen 的時候 WITH_CJK (mhsin's cjkwidth)
rafan 的 poorman box drawing patch
chinese/mutt
不用 set charset, set locale 了. mutt 會看 LANG 幫你轉
charset-hook, send_charset 我還是留著
set ascii_chars=yes
assume_charset (included in chinese/mutt, included in mutt-devel 1.5.15)
裝 devel/ncurses (5.5_1 之後版本),再裝 mutt 就會自動用 ncursesw,畫面會比較正確 (20070309 之後的 7-CURRENT 不用裝了,20070407 之後的 6-STABLE 不用裝了)
BBS
我現在都用 luit 幫我轉
x11/rxvt-unicode
x11/rxvt-unicode WITH_ENCODING=all
我的設定檔
chinese/oxim
從 xcin 2.5.2-pre3 改出來的,支援 UTF-8 (我現在用的)
x11/mlterm
他用自己的轉碼表之類的,antialias 很慢,我不太喜歡用。推薦 rxvt-unicode
chinese/irssi
LANG/LC_CTYPE 要設對,否則 input line 會怪怪的。
0.8.10 以後的版本
/set term_charset utf-8 # 最好 /save 然後重新進入 irssi. 或者讓 irssi 自己看 LANG
recode_fallback big5
recode_out_default_charset big5
recode_transliterate off
/recode add #ntucsie utf-8
term_charset 可以不用,他會看 LANG
避免有些字當 big5/utf8 都可以解的,在純 big5 channel 最好還是 /recode add big5
UTF-8 IRC notes
converters/convmv
http://j3e.de/linux/convmv/
先 [=convmv -f big5 -t utf8 *] 確定沒問題,再加 [=–notest] 轉換.
也有其他好用 option 譬如 [=-r recursive],或 [=–unescape] 對付 %20
根據convmv網頁上的資訊,目前perl 5.8.7似乎有些問題,若使用 1.0.9之前的版本
請多加 –nosmart參數才能正確轉換
意即請使用 convmv -f big5 -t utf8 * –notest –nosmart