Use the iconv method for encoding conversion. It can work normally under the windows platform (win7 used in the local environment), but iconv always returns false under the linux environment (linux used in the test environment).
Refer to phpinfo information, the iconv module has been loaded correctly.
Google it. It turns out that there are still some problems with the iconv method under the Linux version.
The solution given by a netizen on csdn is:
One way is to replace iconv with mb_convert_encoding
Another method is to modify the implementation of iconv from glibc to libiconv
I’ve been working on it for a long time and I’m irritated!
If a friend encounters it, you can solve it this way
According to the first method provided by this netizen, modify the iconv method to use mb_convert_encoding, and it's done. .
Thanks to this netizen for the solution.
Download: ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.8.tar.gz
Installation:
#cp libiconv-1.8.tar.gz /usr/local/src
#tar zxvf lib*
#./configure --prefix=/usr/local/libiconv
#make
#make install
Compile php
#./configure --prefix=/usr/local/php4.3.2 --with-iconv=/usr/local/libiconv/
Simple example of usage:
echo iconv("gb2312","ISO-8859-1","we");