Home > Backend Development > PHP Tutorial > The iconv() function of php under linux_PHP tutorial

The iconv() function of php under linux_PHP tutorial

WBOY
Release: 2016-07-13 16:59:31
Original
951 people have browsed it

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");

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631324.htmlTechArticleUse 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 (used in the test environment...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template