Problem of converting UTF-8 from htmlentities to Chinese $ str = "Chinese"; echo & nbsp; json_encode ($ str); displayed as: [null] & nbsp; so I plan to use htmlentities & nbsp; please refer to the following link for details: $ str = htmlentities ($ str, UTF-8); echo & nbsp; j: converting htmlentities to UTF-8 in Chinese
$ Str = "Chinese ";
Echo json_encode ($ str );
Shown:
[Null]
So I want to use htmlentities to turn it over:
$ Str = htmlentities ($ str, UTF-8 );
Echo json_encode ($ str );
The result is a very depressing problem.
Notice: Use of undefined constant utf-assumed 'utf' in F: \ work \ test. php on line 24
The result is successfully converted, but I don't know why the error is reported!
------ Solution --------------------
The parameters must be enclosed in quotation marks. why not use iconv?
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.