kardo_qadir
1 month ago

How to show grabled text into unicode in mysql?

Posted 1 month 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);
}
$conn->set_charset("utf8");

$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>";
    }
}

$conn->close();

What is the solution?

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