0

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();
?>
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Samuel
  • 7
  • 6
  • what is the actual database encoding? and table, and columns! – delboy1978uk Feb 13 '18 at 11:34
  • @delboy1978uk Thanks. utf8_general_ci, also the columns. – Samuel Feb 13 '18 at 11:38
  • 2
    Possible duplicate of https://stackoverflow.com/questions/16836731/how-to-insert-an-hebrew-value-into-a-mysql-db-in-php – Weenesta - Mathieu Dormeval Feb 13 '18 at 11:40
  • ok, and what is the charset HTML meta tag for your web GUI phpmyadmin? Incidentally, you are FAR better using HeidiSQL (Win) or Sequel Pro (Mac). – delboy1978uk Feb 13 '18 at 11:40
  • @MathieuDormeval I saw and tried that solution, but it did not work for me. – Samuel Feb 13 '18 at 11:45
  • Possible duplicate of [How to insert an hebrew value into a mysql db in php](https://stackoverflow.com/questions/16836731/how-to-insert-an-hebrew-value-into-a-mysql-db-in-php) – zyexal Feb 13 '18 at 11:47
  • once you have checked the charset of phpmyadmin, you should install one of those applications and check without going through a web server, which is what phpmyadmin is doing – delboy1978uk Feb 13 '18 at 11:50
  • also, check the actual connection initiated is utf 8 https://stackoverflow.com/questions/4777900/how-to-display-utf-8-characters-in-phpmyadmin – delboy1978uk Feb 13 '18 at 11:54
  • @delboy1978uk Thanks, I checked that under information_schema > schemata and it is set on utf8 – Samuel Feb 13 '18 at 12:06

1 Answers1

0

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.

Samuel
  • 7
  • 6