====== 前言 ====== 我最近在把 FreeBSD 底下的環境換成 Unicode (UTF-8) 環境,底下是一些需要的設定之類的。另外,感謝 kcwu 提供許多協助跟 patches。 ====== 系統 ====== * 5.x or above * [[http://opal.com/freebsd/unicode.html|Unicode Support in FreeBSD]] ====== 需要修正的東西 ====== ===== 轉碼表 (Big5-2003) ===== * 理由是因為 Unicode 那邊的 Big5 表日文對應是錯誤的,換 Big5-2003 只是因為它是標準(列在 CNS11643 新版附錄) * [[http://www.csie.ntu.edu.tw/~r92030/project/big5/|kcwu's Big5-2003]] * 我把 libiconv, screen 做成 [ports http://rafan.infor.org/patch/big5/],不過這個版本的 screen 我有包了 [[http://www.mhsin.org/~mhsin/patches/screen/patch-cjkwidth|mhsin 的字寬 patch]]、[[http://www.mhsin.org/screen/|mhsin 的 antiidle patch]],以及 [[http://www.rafan.org/patch/big5/screen/files/patch-poorman-drawing|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 [[ftp://ftp.gnome.org/pub/GNOME/sources/vte/0.16/vte-0.16.2.news|NEWS]]) ====== 軟體 ====== ===== PuTTY ===== * 把 encoding 設定成 UTF-8,"Treat CJK... as wide" 打開,box drawing characters 就是雙字寬了 (請用 PuTTY 0.58 或以上版本) * [[http://ntu.csie.org/~piaip/piety/|PieTTY]] 對 UTF8 的支援也很不錯喔,也有內建字寬修正等 ===== shell ===== * LANG=zh_TW.UTF-8; 很多程式會看 LANG,LC_CTYPE. 以前亂設的請拿掉. * alias b5="LANG=zh_TW.Big5 /usr/X11R6/bin/luit" ===== luit ===== * [[http://www.csie.ntu.edu.tw/~r92030/project/big5/big5.eten-0.enc.gz|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) * [[http://www.rafan.org/patch/big5/screen/files/patch-poorman-drawing|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 * [[http://rafan.infor.org/conf/urxvt.conf|我的設定檔]] ===== 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 * [[utf8irc|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