mysql - PHP print UTF8 string from database -


i trying print simple string in hebrew (utf8) mysql database. in database string correctly, when print string it's - ×—× ×•×ª_חיות .

i happy if can me understand why happened , how can fix it. thanks.

php -

$conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) {     die("connection failed: " . $conn->connect_error); }  mysqli_set_charset($conn,"utf8");  $sql = "select * items id = '$token'"; $result = $conn->query($sql);  if ($result->num_rows > 0) {     while($row = $result->fetch_assoc()) {         echo "," . $row["title"];     } } else {     echo "not found row"; } mysqli_close($conn); 

how html document like? have set utf8 character set? should this:

<!doctype html> <html lang="en">   <head>     <meta charset="utf-8">     <title>title</title>     <link rel="stylesheet" href="style.css">     <script src="script.js"></script>   </head>   <body>     <?php       //your php code        ?>   </body> </html> 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -