简体   繁体   English

如何(a)在phpMyAdmin中编写非拉丁文字,以及(b)在使用php的浏览器中显示非拉丁文字

[英]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: (a)在phpMyAdmin中,我可以选择以下两个希伯来语选项:

  1. hebrew_general_ci hebrew_general_ci
  2. hebrew_bin hebrew_bin

after picking one of these - I can see in phpMyAdmin the characters properly. 选择其中之一后-我可以在phpMyAdmin中正确看到字符。

What are the differences? 有什么区别? and shouldn't I be picking utf-8 instead? 我不应该选择utf-8吗?

(b) Regarding the PHP - the html file can show me hebrew because I have this line encoded: (b)关于PHP-html文件可以向我展示希伯来语,因为我对这一行进行了编码:

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

and if I would write "echo אבגדה" (non-latin) it will also work. 如果我写“ echoאבגדה”(非拉丁语)也可以。

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">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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