1

i am trying to select from SQL database (hebrew chars like שלום) and i see it like a ????? in my page i configure my html settings to UTF-8 but in phpmyAdmin i dont know what to do in the settings

thanks for help .

juergen d
  • 201,996
  • 37
  • 293
  • 362
Daniel Mamary
  • 29
  • 1
  • 6

1 Answers1

0

Use these to convert database/table to utf8.

ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

How to convert an entire MySQL database characterset and collation to UTF-8?

SQL should now store and return utf-8 strings.

Community
  • 1
  • 1
Outshined
  • 709
  • 7
  • 22
  • i used this script and i have the same problem in database its work fantastic but in the page its doesnt change maybe because i am using in my php file '. htmlspecialchars($row['day']) .' ? – Daniel Mamary Sep 26 '16 at 12:42
  • @DanielMamary If your database table is utf8 encoded, then the problem (most probably) is in your php file. Share some code sample how you use this sql data and someone may help you :) – Outshined Sep 26 '16 at 12:50
  • `echo '
    `
    – Daniel Mamary Sep 26 '16 at 13:08
  • I don't know php much, but I think this article can help you: https://www.toptal.com/php/a-utf-8-primer-for-php-and-mysql – Outshined Sep 26 '16 at 13:29
  • I'd check if you set mysql output charset to utf8 first: mysql_set_charset('utf8', $link); – Outshined Sep 26 '16 at 13:30
  • i didnt use this command in my code i am using this script `// Create connection $conn = new mysqli($servername, $username, $password,$dbname); **here ??** // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected to Dates SQL system" . "
    "; $sql = "SELECT * From orders"; $result = $conn->query($sql); $num_rows = mysqli_num_rows($result); if($num_rows>=0) { while($row = $result->fetch_assoc()){
    – Daniel Mamary Sep 26 '16 at 22:24
  • Yes, try adding the following: mysql_set_charset('utf8', $conn); right after creating mysql connection – Outshined Sep 27 '16 at 08:53
  • doesnt work + i used this command header("Content-Type: application/json; charset=UTF-8"); – Daniel Mamary Sep 30 '16 at 17:16