PHP MySQL 希腊字母显示为 ????分数

2022-01-07 00:00:00 character-encoding php mysql

我有一个包含一些文本的表格,文本是希腊字母,当我使用 sql 工具并从该表格中选择数据时显示正确

I have a table with some text and text is greek letters, when i use sql tool and select the data from this table is showing correctly

但是当我使用 mysql_fetch 数组显示我的站点前端时,当回显时它显示如下

But when i show this my site frontend using mysql_fetch array and when echo it shows as below

任何人都知道如何解决这个错误谢谢.

Anyone know how to fix this error thank you.

推荐答案

请尝试以下操作:

在您连接到 mysql 后,执行此查询以确保您使用的是 UTF8:

after you connect to the mysql, do this query to make sure that you are using UTF8:

mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");

确保在 HTML (head) 中使用正确的编码,尝试:

make sure that in HTML (head) you are using the right encoding, try:

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

如果这没有帮助,请尝试不同的编码,例如 ISO-8859-1

if this does not help, try different encoding, like ISO-8859-1

相关文章