我需要将整个数据库的编码更改为 UTF8。
我之前是这样连接到数据库的:
// MySQL connect information.
$username = "root";
$password = "";
$host = "localhost";
$database = "yac";
// Connect.
$connection = mysql_connect($host, $username, $password)
or die ("It seems this site's database isn't responding.");
mysql_select_db($database)
or
die ("It seems this site's database isn't responding.");
我的数据库内容没有存储到数据库中mysql_query("SET NAMES UTF8");
,数据如下:
باشگاه هوانوردان جوان
现在最近我像这样连接到数据库:
$mysql_username = "root";
$mysql_password = "";
$mysql_host = "localhost";
$mysql_database = "tick5";
$connection = mysql_connect($mysql_host, $mysql_username, $mysql_password) or die ("It seems this site's database isn't responding.");
mysql_select_db($mysql_database) or die ("It seems this site's database isn't responding.");
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER_SET utf8");
和存储的数据是这样的:
عنوان مقاله
因为我mysql_query("SET NAMES UTF8");
在 INSERT 查询之前使用过,所以我没有任何问题,但现在我需要我的旧内容,我想更改编码并解决这个问题。
这个怎么做?
注意:我的表格排序规则是utf8_unicode_ci