Iconv () [Function.iconv]: detected an illegal character in_php tutorial

Source: Internet
Author: User
This article to introduce Iconv () [Function.iconv]: detected an illegal character in error several solutions, there is a need to understand the friend can refer to.

When using the Iconv function to convert gb2312 to Utf-8, how do some Chinese characters appear to have problems, like "??". quot, the Word will prompt as follows:
Notice:iconv () [Function.iconv]: detected an illegal character in input string

Workaround:

The code is as follows Copy Code

Iconv (' UTF-8 ', ' gb2312//ignore ', '?? ')
Iconv (' UTF-8 ', ' GBK ', '?? ')

Either the encoding is incorrect or the suppression is added

We can also use other methods to manipulate

Make a GBK to UTF-8


Mb_convert_encoding () using the detailed

PHP code

The code is as follows Copy Code

Header ("content-type:text/html; Charset=utf-8 ");
Echo mb_convert_encoding ("??? s my friend "," UTF-8 "," GBK ");
?>


One more GB2312 to Big5.

The code is as follows Copy Code
Header ("content-type:text/html; Charset=big5 ");
Echo mb_convert_encoding ("You Are my Friend", "Big5", "GB2312");
?>

http://www.bkjia.com/PHPjc/632119.html www.bkjia.com true http://www.bkjia.com/PHPjc/632119.html techarticle This article to introduce Iconv () [Function.iconv]: detected an illegal character in error several solutions, there is a need to understand the friend can refer to. Convert gb2312 to ... using the Iconv function .

  • 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.