How does PHP filter special kanji? or replace 16 binary.

Source: Internet
Author: User
How does PHP filter special characters? or replace 16 binary:
In the process of calculating a DOM, because there is a man in the body who does not know what the Chinese character

As a result, the following code appears with the following error

Code:

PHP Code
  
   $DQ = new Zend_dom_query ($body); $DQ->query ("*");



The original body is gb2312 encoded, and the error that occurs is:

[0]=>
Object (Libxmlerror) #45 (6) {
["Level"]=>
Int (3)
["Code"]=>
Int (6003)
["Column"]=>
Int (0)
["Message"]=>
String (*) "input conversion failed due to input error, bytes 0xCB 0x87 0xCA 0xFB
"
["File"]=>
String (0) ""
["Line"]=>
Int (0)
}


Error in 0xCB 0x87 0xCA 0xFB is (art villa) Two words, I do not know if this post submitted after the Chinese character can be displayed correctly, Baidu Search is not ...

Is there a way to replace these two characters?

I str_replace, I didn't succeed.

Preg_replace doesn't seem to be good either.

PS can be seen in the ultraedit .....

is how to replace the 16 binary???


------Solution--------------------
Body changed to GBK?
------Solution--------------------
Turn into coded form
$str = ' People's Republic of China ';
$str = mb_convert_encoding ($str, "html-entities", "utf-8");//Result: Which team is the first to tee off
  • 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.