Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

json_encode return encoded utf-8 string

on shared apache server which host my website I can not set default server settings to utf-8

and in PHP json_encode return encoded utf-8 string from text like:
مرتضی
to :
\u0645\u0631\u062a\u0636\u06cc

how can I prevent this or how return it back to original text encoding?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Just use the JSON_UNESCAPED_UNICODE flag:

echo json_encode($str, JSON_UNESCAPED_UNICODE);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading