Arabic Characters in JSON decoding [duplicate]

Solution 1:

"\u0628\u0633\u0645 \u0627\u0644\u0644\u0647" and "بسم الله" are equivalent in JSON.

PHP just defaults to using Unicode escapes instead of literals for multibyte characters.

You can specify otherwise with JSON_UNESCAPED_UNICODE (providing you are using PHP 5.4 or later).

json_encode('بسم الله', JSON_UNESCAPED_UNICODE);

Solution 2:

That is the correct JSON encoded version of the UTF-8 string. There is no need to change it, it represents the correct string. Characters in JSON can be escaped this way.

JSON can represent UTF-8 characters directly if you want to. Since PHP 5.4 you have the option to set the JSON_UNESCAPED_UNICODE flag to produce raw UTF-8 strings:

json_encode($string, JSON_UNESCAPED_UNICODE)

But that is only a preference, it is not necessary.