How to get Arabic data in MariaDB?

I followed many of the answers here for my case and it doesn't work.

I have some Arabic values ​​inserted into a database. I am getting Arabic values ​​like \u0645\u0628\u0627\u0631\u0627

.

My database collation is : UTF8_general_ci
Server charset: UTF-8 Unicode

Tables and columns collation are : UTF-8 Unicode

      

This is my php connection file:

<?php 
$host="";
$user="";
$password="";
$db="";


$con= mysqli_connect($host,$user,$password,$db) or die("Unable to connect");
$sSQL= 'SET CHARACTER SET utf8'; 
mysqli_query($con,$sSQL);

if(mysqli_connect_error($con))
{
echo "Failed to connect to database ".mysqli_connect_error();
}


$sql="select id_livestream,name_match,time_match,name_league,name_stadium,name_team1,name_team2,image_team1,image_team2,live from Livestream,staduim,League WHERE Livestream.stadium=staduim.id_stadium and Livestream.league_type=League.id_league";
$result=mysqli_query($con,$sql);
if($result)
{
    while($row=mysqli_fetch_array($result))
    {
    $flag[]=$row;
    }
    print(json_encode($flag));
    }
    mysqli_close($con);
   ?>

      

Note. The arabic values ​​have been inserted successfully into the database, but when I get the data, I get it as \ u0645 \ u0628 \ u0627 \ u0631 \ u0627

+3


source to share





All Articles