created a table with different languages, all columns have utf8_unicode coding, except for columns with Russian letters, there utf8_general-ci and the table itself is compared using utf8_unicode, when outputting from php via encode, only English letters are correctly output, and the rest (Chinese, Japanese and Russian) are output like this \ u0420 \ u041e \ u042b \ u0420 \ u0410 \ u041e \ u0410 \ u0420 \ u041e, how to fix it?

PS output function:

<?php require_once 'db_config.php'; // ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π°Π΅ΠΌ скрипт // ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π°Π΅ΠΌΡΡ ΠΊ сСрвСру $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); if(isset($_REQUEST["wordEnglish"])){ $wordEnglish =$_REQUEST["wordEnglish"]; $query ="SELECT * FROM translated_words WHERE wordEnglish = '$wordEnglish'"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); if($result) { while($row = mysqli_fetch_array ($result)){ $client["wordEnglish"] = $row["wordEnglish"]; $client["defenitionEnglish"] = $row["defenitionEnglish"]; $client["wordRussian"] = $row["wordRussian"]; $client["defenitionRussian"] = $row["defenitionRussian"]; $client["wordChina"] = $row["wordChina"]; $client["defenitionChina"] = $row["defenitionChina"]; $client["wordJapan"] = $row["wordJapan"]; $client["defenition_Japan"] = $row["defenition_Japan"]; } } } if(isset($client)){ echo (json_encode($client)); } else{ echo (json_encode(null)); } // Π·Π°ΠΊΡ€Ρ‹Π²Π°Π΅ΠΌ ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ mysqli_close($link); ?> 
  • This is unicode. The database stores the data that you submit to it. So you kept them in this form. - Jean-Claude
  • @ Jean-Claude I gave her hieroglyphs and Russian letters, and the output via encode this happens, should I change the encoding? - Aleksey Paul
  • It is worth reviewing the output function. what have bd in general .. - Jean-Claude
  • @ Jean-Claude, the output is implemented via encode, the php code is attached to the topic - Aleksey Paul
  • This is a completely normal json with foreign letters, no corrections are required here - andreymal

1 answer 1

 echo (json_encode($client,JSON_UNESCAPED_UNICODE)); 

The answer was given in the comments to the question.