开发者

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?


Try changing the collation to utf8_bin, and changing the encoding line to

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜