Iconv () [function. iconv]: Detected an illegal character in

Source: Internet
Author: User

This article introduces several solutions to iconv () [function. iconv]: Detected an illegal character in errors. For more information, see.

When I use the iconv function to convert gb2312 to UTF-8, why do some Chinese characters have problems, such "?? Quot; the prompt is as follows:
Notice: iconv () [function. iconv]: Detected an illegal character in input string

Solution:

The Code is as follows: Copy code

Iconv ('utf-8', 'gb2312 // IGNORE ','?? ')
Iconv ('utf-8', 'gbk ','?? ')

Or the code is not correct, or the inhibitor @ is added @

We can also use other operations

Make a GBK To UTF-8


Mb_convert_encoding ()

Php code

The Code is as follows: Copy code

<? Php
Header ("content-Type: text/html; charset = Utf-8 ");
Echo mb_convert_encoding ("??? S my friends "," UTF-8 "," GBK ");
?>


Another GB2312 To Big5
 

The Code is as follows: Copy code
<? Php
Header ("content-Type: text/html; charset = big5 ");
Echo mb_convert_encoding ("you are my friend", "big5", "GB2312 ");
?>

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.