PHP: GNU Recode funkce - Manual
PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links | my php.net 
search for in the  
<readlinerecode_file>
view the version of this page
Last updated: Thu, 15 Jul 2004

XCIII. GNU Recode funkce

�vod

Tento modul obsahuje rozhran� ke GNU Recode knihovn�, verze 3.5. GNU Recode knihovna konvertuje soubory mezi r�zn�mi znakov�mi sadami a k�dov�n�mi. Kdy� nelze dos�hnout p�esn� konverze, m��e se uch�lit k aproximac�m. Tato knihovna rozezn�v� nebo produkuje t�m�� 150 r�zn�ch znakov�ch sad, a je schopn� konvertovat soubory mezi t�m�� libovoln�m p�rem. Podporuje v�t�inu znakov�ch sad z .

Pozn�mka: Toto roz���en� nen� k dispozici na platform�ch Windows.

Po�adavky

Na sv�m syst�mu mus�te m�t nainstalovanou GNU Recode 3.nebo vy���. Bal��ek lze st�hnout z .

Instalace

Pokud cchete pou��vat funkce definovan� v tomto modulu, mus�te zkompilovat v� PHP interpretr s volbou --with-recode[=DIR].

Varov�n�

Pad�n� a probl�my p�i startu PHP mohou b�t zaznamen�ny kdy� nahr�v�te roz���en� Recode po nahr�n� roz���en� mysql nebo imap. Nahr�n� Recode p�ed t�mito roz���en�mi probl�m vy�e��. Je to kv�li technick�mu probl�mu spo��vaj�c�mu v tom, �e ob� C-knihovny pou��van� knihovnou imap a recode maj� svou vlastn� funkci hash_lookup() a ob� knihovny pou��van� mysql a recode maj� svou vlastn� funkci hash_insert.

Varov�n�

Roz���en� IMAP nem��e b�t pou��v�no z�rove� s roz���en�m recode nebo YAZ. Je to kv�li faktu, �e tato roz���en� sd�lej� stejn� intern� symbol.

Konfigurace b�hu

Toto roz���en� nem� definov�no ��dn� konfigura�n� direktivy.

Typy prost�edk�

Toto roz���en� nem� definov�n ��dn� typ prost�edku (resource).

P�eddefinovan� konstanty

Toto roz���en� nem� definov�ny ��dn� konstanty.

Obsah
recode_file --  P�ek�duje soubor na soubor podle po�adavku
recode_string -- P�ek�duje �et�zec podle po�adavku
recode -- P�ek�duje �et�zec podle po�adavku


add a note add a note User Contributed Notes
GNU Recode funkce
pet at humaj dot sk
30-Apr-2003 01: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
-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 05: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 ) to get rid of this error. It doesn't matter if you're compiling PHP as DSO.

<readlinerecode_file>
 Last updated: Thu, 15 Jul 2004
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2004 The PHP Group
All rights reserved.
This unofficial mirror is operated at: /
Last updated: Sun Nov 14 23:09:54 2004 Local time zone must be set--see zic manual page