简体   繁体   中英

how to (a) write non-latin text in phpMyAdmin and (b) show it on a browser using php

I have seen some solutions but I can't seem to understand how to make it work.

(a) in phpMyAdmin I can select between these 2 options for hebrew:

  1. hebrew_general_ci
  2. hebrew_bin

after picking one of these - I can see in phpMyAdmin the characters properly.

What are the differences? and shouldn't I be picking utf-8 instead?

(b) Regarding the PHP - the html file can show me hebrew because I have this line encoded:

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

and if I would write "echo אבגדה" (non-latin) it will also work.

The problem is with taking the database data and show it properly (it shows "??????").

here is the simple code:

<?php

$con = mysql_connect("localhost","root","my_password");

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("boomerang", $con);

$result = mysql_query("SELECT * FROM words");

while($row = mysql_fetch_array($result))
  {
  echo $row['blabla'];
  }

mysql_close($con);

?>

What do I need to add to make it work?

尝试将排序规则更改为utf8_bin,并将编码行更改为

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-8-i">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM