Hello forgive me for being new to this but I'm trying to output some unicode data from my php file.
The string that is suppose to be output is: "SD Tết Festival"
However I seem to be getting: "SD T\u1ebft Festival"
It's probably an easy overlook, but I cant figure it out.
I have searched and followed solutions here:
PHP snippet code:
$sql = "select * from info";
mysqli_query($connection, "set character_set_client='utf8'");
mysqli_query($connection, "set character_set_results='utf8'");
mysqli_query($connection, "set collation_connection='utf8_general_ci'");
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
$rowCount = $result->num_rows;
$index = 1 ;
$newArray = [];
while($row =mysqli_fetch_assoc($result))
{
$newArray[$row['type']] = $row['content'];
}
echo json_encode($newArray);
What do I seem to be doing wrong?
Thanks!
UPDATE:
I've added the following code as suggested by the solution in the duplicate question:
$connection->set_charset('utf8mb4');
mysqli_set_charset($connection, 'utf8mb4');
and removed:
mysqli_query($connection, "set character_set_client='utf8'");
mysqli_query($connection, "set character_set_results='utf8'");
mysqli_query($connection, "set collation_connection='utf8_general_ci'");
However, the output is still the same.
UPDATE 2: As suggested in the comment, I made sure the table and collation supports utf8mb4 as so:
I still seem to be getting the same output.