Wednesday, February 9, 2022

[FIXED] Getting Gibberish on phpmyadmin output

Issue

I'm trying to send Hebrew content through to show up on phpmyadmin. English letters go through perfectly, but Hebrew gives me something like this: חן דו××§.

phpmyadmin collation is set on utf8_unicode_ci (Also tried utf8_general_ci). How can I solve it?

This is my code:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php

header('Content-Type: text/html; charset=utf-8');

$servername = "//";
$username = "//";
$password = "//";
$dbname = "//";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$sql = "INSERT INTO nigunim (name, time, day)
VALUES ('בדיקה', 'בדיקה', 'בדיקה')";

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

Solution

Finally fixed by creating a new table and then adding mysql_set_charset("UTF8", $conn); along with making sure collation is set to utf8_general_ci.



Answered By - Samuel

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.