作者Gjoy (鬼接)
看板PHP
標題Re: [請益] html unicode
時間Sat Jun 6 17:04:17 2009
※ 引述《buganini (霸格尼尼)》之銘言:
: http://github.com/buganini/bsdconv
: 如果你是用FreeBSD或Linux可以試一下
: Linux編譯的時候LDFLAGS要加個-ldl
: 裡面有php的wrapper
: 外面先make && make install之後
: 到wrapper/php/
: phpize
: ./configure LDARGS="-lbsdconv"
: make
: make install
: 然後php裡面可以用
: $h=bsdconv_create('htmlentity,big5,ascii::utf-8');
: $str=bsdconv($h,$str);
: bsdconv_destroy($h);
: 就可以把$str轉成utf-8
感謝,我使用的是RHEL5.3 x64 , 一開始無法直接make & make install
於是安裝gcc套件: yum install gcc
再Makefile加上一行:
CC=/usr/bin/gcc -ldl
這時外部已經可以順利make & make install
接下來進入wrapper/php, 系統沒有phpize
於是安裝php-devel套件: yum install php-devel
接下來:
/usr/bin/phpize
./configure LDARGS="-lbsdconv"
到這裡還算順利
接下來: make : 發現沒有bsdconv.h
於是到外層的 build/include 把 bsdconv.h 複製到 wrapper/php
順利 make & make install 成功
最後安裝到這裡:
Installing shared extensions: /usr/lib64/php/modules/
裝進去了 還未測試
等測試後小弟再發一篇
感謝buganini ^_<
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.117.24.1
※ 編輯: Gjoy 來自: 140.117.24.1 (06/06 17:05)
推 buganini :忘了說 預設路徑我是寫/usr/local/ (FreeBSD style) 06/06 20:17
→ buganini :Linux可以用make PERFIX=/usr 06/06 20:17
推 buganini :make PREFIX=/usr 06/06 21:28
推 buganini :如果抓出來的資料 許功蓋 有多餘\的話 06/07 10:39
→ buganini :用htmlentity,big5-5c,big5,ascii::utf-8 06/07 10:40