Q: PHP json_encode and utf8_encode not working with my php file I have some json I need to encode - Vietnamese word.  I try use  JSON_UNESCAPED_UNICODE but look like it's not working anymore. 
  header("Content-type: application/json; charset=utf-8");
  $db = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysqli_connect_errno());
  $result = mysqli_query($db,"SELECT * FROM categories") ;
  if (mysqli_num_rows($result) > 0) {
    $response["categories"] = array();
    while ($row = mysqli_fetch_array($result)) {
       $categories["id"] = json_encode($row["id"]);
       $categories["name"]= json_encode($row["name"],JSON_UNESCAPED_UNICODE);
       array_push($response["categories"], $categories);
    }
    $response["result"] = "OK";
    $myJSON = json_encode($response);
    echo $myJSON;
  }

Input: 

id=1 name=Truyện Cổ Tích 

Output: 

id= 1 name = false 

It's my first time i try PHP. My php version is 7.2.8.  

A: *

*first run mysqli_query('SET NAMES utf8').

*print the error info by json_last_error()

A: You must config connect SQL that it can encode set mysqli_set_charset($con,"utf8");
