0

I did all changes as the answer instructed in this post in order to be able to print hebrew strings coming from the database but didnt work.

this is my php code:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>

<?php
header('Content-Type: text/html; charset=utf-8');
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "dbName";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
mysql_query("SET NAMES 'utf8'");
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT * FROM users";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["id"]. " - Name: " . $row["name"]. " - Score: " . $row["score"]. "<br>";
    }
} else {
    echo "0 results";
}
$conn->close();
?>

</body>
</html>

every thing works accept that insted of the hebrew strings i only see question marks (???). any idea why??

Community
  • 1
  • 1
Al.s
  • 300
  • 4
  • 20

1 Answers1

-1

Set the Browser's Character Settings to Hebrew.

FireFox:Tools=>Options=>Content=>Advanced=>Fallback Character Encoding = Hebrew

Google Chrome: Menu=>Settings=>Show Advanced Settings=>Language and input settings

UPDATE:
When you save the text first recode the text.

Try using GNU Recode?

$text = mysqli_real_escape_string(recode_string(characterSet,$text));

Where characterSet complies with RFC-1345, e.g. 'latin1'
Valid Character sets: http://www.faqs.org/rfcs/rfc1345.html

Misunderstood
  • 5,534
  • 1
  • 18
  • 25