in phpmyadmin, the database and all tables are set to compare utf8_unicode_ci, in the my.ini file the comment line is uncommented

collation_server=utf8_unicode_ci character_set_server=utf8 

Prior to this Cyrillic on the page was displayed questions. Now Cyrillic is displayed in the form of character codes:

 \u041a\u0438\u0440\u043e\u0432\u0441\u043a\u0438\u0439 

In Google, I did not find anything on this issue, how can I solve this problem?

    3 answers 3

    Use the JSON_UNESCAPED_UNICODE flag in the json_encode function

    For more information, see http://php.net/manual/ru/function.json-encode.php and http://php.net/manual/ru/json.constants.php

      In my case, the answer is that the json_encode function, as I just learned, converts the Cyrillic alphabet into a sequence of character codes. Those. Without json_encode, the data from the database is getting correct.

      • one
        Where in your question is something said about json_encode? - Alexey Shimansky
      • @ Alexey Shimansky if I knew that this is important ... I thought that json_encode simply takes values ​​from an array and converts them to json format without any transformations. - Razorik

      If you see questions, this means the encoding is undecided. The reason may be that your source file is in a different encoding (not the one specified in the server setup). With high probability we can assume that your web server settings are UTF8 (unicode) and the file is in CP1251 (windows).