How PHP converts Unicode encoding to Chinese characters

Source: Internet
Author: User
PHP converts Unicode encoding to Chinese characters. the webpage displays Chinese characters, but the source code shows the following unicode encoding: PHPcode & amp; #12304; GNIOUS & amp; #12305; & amp; #30701; & amp; #34966; & amp; #24773; & amp; #20387; how can PHP convert Unicode encoding to Chinese characters?
The webpage displays Chinese characters, but the source code is the unicode code below.

PHP code
  [GNIOUS] short-sleeved couples T-shirt Grand City love 4-time stamp-rose ----- click on the circle on the picture, directly buy this baby -------


How does PHP convert this code into Chinese characters? Because you need to call these Chinese characters for search strings

------ Solution --------------------
$ S = <CODE
GNIOUS
CODE;

Function foo ($ v ){
Return iconv ('ucs-2', 'gbk', pack ('N', $ v [1]);
}

Echo preg_replace_callback ('/& # (\ d +);/', 'foo', $ s );

GNIOUS

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.