又一個轉碼函式庫

看板PHP作者 (霸格尼尼)時間16年前 (2009/05/23 20:34), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/3 (看更多)
http://github.com/buganini/bsdconv/downloads 我只有在FreeBSD底下測試 Linux底下應該也可以 Windows的話可能會有幾個問題: mmap(印象中windows沒有), 而且wrapper/php裡面沒有config.w32 -- command-line用法 bsdconv big5,ascii::utf-8 in.txt out.txt 這樣可以把中英文夾雜的big5檔轉成utf-8 -- conversion範例 big5,ascii:chs:utf-8 big5轉簡體utf-8 utf-8:cht:utf-8 utf-8簡轉繁 utf-8:chs:cp950,htmlentity 轉簡體後能用big5的繼續用big5 big5沒有的用htmlentity utf-8::html-img 用<img>顯示unicode.org的圖檔 Big5資料庫要轉UTF-8的時候 假設dump出來的形式是 "&#35835;功\能test"這樣的形式(甚至裡面還有UAO也沒關係) htmlentity,big5-5c,big5,ascii::utf-8 應該就可以搞定了 -- phpwrapper用法 $h=bsdconv_create('big5,ascii::utf-8'); echo bsdconv($h, $str); bsdconv_destroy($h); -- codecs 現在很少, 而且有些還不太正確 有待大家幫忙. 注意有些codecs不是一對一的, 像from/big5實際上是 http://www.moztw.org/docs/big5/table/moz18-b2u.txt 的alias (所以才會支援UAO) 目前並沒有to/big5 簡繁對照表的資料來自 http://www.china-language.gov.cn/gfbz/shanghi/002.htm 但好像不是很完善 -- 國愛‧主民‧學科‧康健‧道人 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.231.23

05/23 22:40, , 1F
好酷的東西XD 可以請問一下效能大概是多少嗎?
05/23 22:40, 1F
※ 編輯: buganini 來自: 220.135.231.23 (07/16 16:34)
文章代碼(AID): #1A5-q-fU (PHP)
討論串 (同標題文章)
文章代碼(AID): #1A5-q-fU (PHP)