Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: Recode - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

recode_file" width="11" height="7"/> <readline
Last updated: Sun, 25 Nov 2007

view this page in

GNU Recode 関数

導入

このモジュールは、GNU recode ライブラリへのインターフェースを 有しています。GNU Recode ライブラリは、様々にコード化された 文字や表面的なエンコード法を相互に変換します。 正確に変換できない場合、問題のある文字を削除するか近似を行います。 このライブラリは、約 150 種類の文字セットを認識、生成することが可能で、 ほとんど全ての組み合わせで相互の変換を行うことができます。 » RFC 1345 文字セットの ほとんどがサポートされています。

注意: この拡張モジュールは Windows 環境では利用できません。

要件

GNU Recode 3.5 以降をシステムにインストールしておく必要があります。 このパッケージは、» http://directory.fsf.org/All_GNU_Packages/recode.html から ダウンロードすることが可能です。

警告

Recode ライブラリのバージョン 3.6 は、ある状況下での文字列の変換時に 変な文字を付加してしまうことがあります。そのため、Recode v3.5 か、あるいは別の選択肢として iconv あるいは mbstring 拡張モジュールを使用するほうが安全です。

インストール手順

本モジュールで定義された関数を使用するには、--with-recode[=DIR] オプションを指定して PHP インタプリタをコンパイルする必要があります。

警告

拡張モジュール mysql または imap をロードした 後に recode を拡張モジュールとしてロードした場合に、 PHP のクラッシュおよび起動に関する問題が 発生する可能性があります。これらの拡張モジュールの前に recode を ロードすることにより、問題を解決することができます。 これは、imap で使用されている c-client ライブラリおよび recode の両方が 固有の hash_lookup() 関数を有しており、 mysql と recode が固有の hash_insert 関数を有している ことによる技術的な問題です。

警告

IMAPrecodeYAZ および Cyrus 拡張モジュールは、組み合わせて使用することはできません。 これは、これらすべてが同一の内部シンボルを使用しているためです。

実行時設定

設定ディレクティブは定義されていません。

リソース型

リソース型は定義されていません。

定義済み定数

定数は定義されていません。

目次

  • recode_file — コード変換指令に基づきファイルからファイルにコード変換する
  • recode_string — コード変換指令に基づき文字列のコードを変換する
  • recode — recode_string のエイリアス


recode_file" width="11" height="7"/> <readline
Last updated: Sun, 25 Nov 2007
 
add a note add a note User Contributed Notes
Recode
theather at I dot am
08-Aug-2005 10:55
I see that the Recode (3.6) module is also incompatible with the MySQL module as well as the others noted in the "warning" note above.
pet at humaj dot sk
30-Apr-2003 10:51
Hope this might help someone:

I tried to compile php 4.3.2-RC2 (+some older versions) with recode AND imap (and gd+png+jpeg support, ldap, gettext, zlib .. but these are not interesting right now).

Why? I needed to run Imp + Horde + Turba. Turba talks to LDAP directory (and LDAP uses utf-8 encoding which I need to convert to iso-8859-2), so I modified Turba to use 'recode' for charset conversions utf8<->iso8859-2.

System: FreeBSD4.7+Apache 1.3.27+Ben SSL

I either could not properly compile OR after compiling apache coredumped.

Problem was: imap (libc-client) and recode (librecode) use the same function hash_lookup(). Therefore during loading libphp.so (and libraries it depended on) whole apache crashed. Without a word of what's going on.

The problem is detectable by forcing static linking (in FreeBSD modify librecode.la and change
library_names='librecode.so.0 librecode.so librecode.so'
to
library_names='librecode.a'

Now during linking of php the linker complains of double definition of hash_lookup.

Solution:

-grab recode3.6 from ftp://ftp.gnu.org/pub/gnu/recode/
-unpack, go to src, in files combine.c, hash.c, names.c, recode.c, testdump.c, html.c, hash.h replace hash_lookup() by hash_lookupX() [or invent some better name],
compile recode (i had to do:

setenv CFLAGS "-I/usr/local/include"
setenv LDFLAGS "-L/usr/local/lib -lintl"
./configure --prefix=/usr/local/recode --exec-prefix=/usr/local/recode --without-included-gettext
make
make check
make install

(recode is installed to /usr/local/recode.You can change this and you can force static linking of recode, so that after building libphp.so this modified recode is no longer needed and can be deleted! )

For some reason this recode needs to have externally defined
int error;
therefore we have to modify configure script +one .c php source file:

1. modify configure script of php: find
recode_format_table();
and somewhere before start of main() add
int error;

so the result is:

char *program_name;
int error;
int main() {
recode_format_table();
; return 0; }

(I modified both occurences of recode_format_table() in configure of php4.3.2rc2)

2. run configure, should work ok (my another problem was with imap: though my c-client was compiled WITHOUT ssl, configure complained that it IS using ssl, so i had to edit configure once again and comment following lines:
void mm_searched(void){}
void mm_expunged(void){}
// char ssl_onceonlyinit();  --- commented
int main() {
// ssl_onceonlyinit(); --- commented
return 0;
}

Now configure was rather happy :-)

for the record: I did
./configure --with-apxs=/usr/local/apache/bin/apxs --with-imap --enable-sysvsem --enable-sysvshm --with-sybase=/usr/local/freetds --with-gettext --with-ldap --with-zlib --with-recode=/usr/local/recode -with-gd=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local

3. edit ext/recode/recode.c (or any other .c source file, add somewhere (e.g. at the end)
int error;

without it during linking 'error not defined' will be complained.

4. do 'make' and php is yours :-)

It took me 2 days.. so do not delete this note, someone might even find it useful and mail me his thanks :-]
cv at corbach dot de
04-Feb-2002 02:06
When compiling PHP into Apache as static module Apache configure will complain about an undefined symbol in librecode. You need recode-3.6 (e.g. on ftp://ftp.gnu.org/pub/gnu/recode/) to get rid of this error. It doesn't matter if you're compiling PHP as DSO.

recode_file" width="11" height="7"/> <readline
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites