8 months ago

How to show grabled text into unicode in mysql?

Posted 8 months ago by kardo_qadir

I had a database which it is charest latin1, the unicode texts are stored like this

چیه‌ و بۆچی به‌كاردێ؟

even I put set names as utf8 but still can not show the real text..

That is my code

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "meko";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);

$sql = "SELECT * FROM mekotopics WHERE id=34512";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        echo "Title:  " . $row["subject"]. "  <br>";


What is the solution?

Please sign in or create an account to participate in this conversation.