PHP transcoding problem, how to gracefully convert UTF-8 into GBK?

Source: Internet
Author: User
Data is delivered on the business occasion and requires transcoding, from UTF-8 to GBK. PHP function compared to the mentally retarded, resulting in a large number of data conversion failure, there is no better transcoding method, you can automatically ignore the content cannot be converted to a successful encoding, do not lose data?

Reply content:

Data is delivered on the business occasion and requires transcoding, from UTF-8 to GBK. PHP function compared to the mentally retarded, resulting in a large number of data conversion failure, there is no better transcoding method, you can automatically ignore the content cannot be converted to a successful encoding, do not lose data?

http://php.net/manual/en/function.iconv.php

Use //IGNORE to ignore words that cannot be converted

phpiconv("UTF-8", "GBK//IGNORE", $text);

Upstairs says the designation ignore is a bit, but this article still has the problem of the bug, simply wrote down:
Http://www.yundaiwei.com/post/375.html

There is almost no introduction to this bug in the Chinese website, the English site is mentioned, but it is not clear, and now do not know which or which version of the bug, in short, the installation of the environment when the latest iconv will not have a problem.

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