在phpmyadmin输出上获得胡言乱语

时间:2018-02-13 11:32:00

标签: php mysql phpmyadmin

我正在尝试发送希伯来语内容以显示在phpmyadmin上。英文字母完美无缺,但希伯来语给了我这样的东西:× - ןדו×ק。

phpmyadmin collat​​ion在utf8_unicode_ci上设置(也尝试了utf8_general_ci)。我该如何解决?

这是我的代码:

<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();
?>

1 个答案:

答案 0 :(得分:0)

最后由创建新表格修复,然后添加mysql_set_charset("UTF8", $conn);并确保将排序规则设置为utf8_general_ci。