如何使用西里尔符号将 php-massive 编码为 JSON


how encode php-massive with cyrillic symbols to json?

请帮助查找错误。 我从MySQL中得到了几个字符串。 这些字符串包含西里尔符号。

<?php
  header("Content-type: text/html; charset=utf-8");
  error_reporting(0);
  require('connectDB.php');
  $connect = mysql_connect($host,$user,$password);
  mysql_query("SET NAMES utf8");
  mysql_select_db($database);
  $sql = 'SELECT `title` FROM `graphs`';
  $result = mysql_query($sql); // or die(mysql_error());
  $response = array();
  if($result){ 
    while($row = mysql_fetch_array($result)) {
      $response[] = $row["title"];
    };
  }
  else{
    $response = 'error';
  } 
  print_r($response);
  print(json_encode($response)); 
?>

但第一个打印运算符输出如下:

数组 ( [0] => ыва [1] => ввв

[2] => ываываывавы )

第二个打印运算符输出如下:

["''u044b''u0432''u0430","''u0432''u0432","''u044b''u0432''u0430''u044b''u0432''u0430''u044b''u0432''u0430''

u0432''u044b"]

我尝试使用没有BOM的EBCODING UTF8重新保存所有文件

尝试执行以下操作:

json_encode($response, JSON_UNESCAPED_UNICODE);