iconv_set_encoding function error


#1

I am getting the following error when using the iconv_set_encoding function:

Fatal error: Call to undefined function: iconv_set_encoding() in C:Program FilesApache2htdocsindex.php on line 6

I am using PHP Version 4.3.6 with Apache 2 under Windows NT.

My code is as follows:

<?php iconv_set_encoding("internal_encoding", "Big5"); iconv_set_encoding("output_encoding", "GB2312"); ob_start("ob_iconv_handler"); ?>

Thanks for any suggestions.


#2

Can’t seem to find the functions so does your PHP build meet all manual requirements?

Requirements

You will need nothing if the system you are using is one of the recent POSIX-compliant systems because standard C libraries that are supplied in them must provide iconv facility. Otherwise, you have to get the libiconv library installed in your system.

Installation

To use functions provided by this module, the PHP binary must be built with the following configure line: --with-iconv[=DIR].

Note to Windows® Users: In order to enable this module on a Windows® environment, you need to put a DLL file named iconv.dll or iconv-1.3.dll (prior to 4.2.1) which is bundled with the PHP/Win32 binary package into a directory specified by the PATH environment variable or one of the system directories of your Windows® installation.

#3

Thanks for the advice.

Does this mean I have to reinstall PHP altogether or can I simply install the library. I’ve downloaded “libiconv-1.9.1.tar.gz” file and extracted it. Any further info would be appreciated. Thanks.


#4

Don’t know alot about this so I guess you would have to rebuild the PHP with the command line --with-iconv[=DIR]. shrugs.

Sorry I could help more.


#5

Is there a difference between the “glibc” and the “libiconv” versions of the iconv library? It seems to encode the characters for the first and not the later.


#6

I honestly haven’t got a clue. do your homework (multiple forums, Google, manual, PHP mailing list archives, ect,) and if you still aren’t finding an answer… the only thing I can suggest is posting it to the PHP general mailing list. I personally dislike asking what I would consider relatively basic questions there (I always feel like an idiot), but I also don’t hesitate if I really can’t find an answer to a question I need to have answered.