The iconv () function of php in linux. Use the iconv method for encoding conversion. It works normally on the windows platform (win7 is used in the local environment), but iconv always returns false in the linux environment (iconv is used in the test environment for encoding conversion. It works normally on the windows platform (win7 is used in the local environment), but iconv always returns false in the linux environment (linux used in the testing environment ).
According to the phpinfo information, the iconv module has been correctly loaded.
Google. It turns out that the iconv method in linux is still a bit problematic.
The solution provided by a user on csdn is:
One way is to change iconv to mb_convert_encoding.
Another method is to modify the implementation of iconv, from glibc to libiconv
It took a long time to get bored!
If you have a friend, you can solve this problem.
Follow the first method provided by the user to change the iconv method to mb_convert_encoding ..
Thank you for your 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:
Echo iconv ("gb2312", "ISO-8859-1", "we ");
Bytes. It works normally on the windows platform (win7 is used in the local environment), but under the linux environment, iconv always returns false (used in the testing environment...