PHP5.3 htmlentities and Json_encode's pit

Source: Internet
Author: User

It's online today.

Json_encode (Htmlentities ($value))

The discovery appeared!

[03-jul-2015 02:52:44 UTC] PHP warning:json_encode_plus () [<a href= ' Function.json-encode-plus ' >function.json-encode-plus</a>]: Invalid UTF-8 sequence in argument in/home/users/ouerqiang/fbiz/framework/bizbootstrap.php on line 106


At first glance, I don't know what the problem is, after it appears that the data found before PHP 5.4

Htmlentities (String,quotestyle,character-set)

Among them character-set=so-8859-1.

If there is Chinese words will be garbled can not escape, Json_encode only recognize UTF-8. Cause error.

Switch

Htmlentities ($instance, ent_quotes, ' UTF-8 ')


Solve


This article is from the "dream to think XI" blog, please be sure to keep this source http://qiangmzsx.blog.51cto.com/2052549/1670507

PHP5.3 htmlentities and Json_encode's pit

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.