The Iconv () function of PHP under Linux _php tutorial

Source: Internet
Author: User
Use the Iconv method for encoding conversions. It works fine under the Windows platform (Win7 used by the local environment), but Iconv always returns false under the Linux environment (the Linux used by the test environment).

Referring to the Phpinfo information, the Iconv module has also been loaded correctly.
Google a bit. Originally only know, originally in the Linux version Iconv this method still a bit under the question.
One of the solutions offered by a netizen on CSDN is:
One way is to replace Iconv with Mb_convert_encoding.
Another way is to modify the Iconv implementation, from GLIBC to Libiconv
Have a half-day, irritability!
If you have a friend, you can solve it.
According to the first method provided by the Netizen, the Iconv method is modified to use mb_convert_encoding, which is done.
Thanks for the solution provided by the Netizen.


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
Compiling PHP
#./configure--prefix=/usr/local/php4.3.2--with-iconv=/usr/local/libiconv/

Simple examples of use:

Echo iconv ("gb2312", "iso-8859-1", "we");

http://www.bkjia.com/PHPjc/631324.html www.bkjia.com true http://www.bkjia.com/PHPjc/631324.html techarticle Use the Iconv method for encoding conversions. It works fine under the Windows platform (Win7 used by the local environment), but Iconv always returns false under the Linux environment (the test environment uses ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.