更新时间:2022-06-03 10:44:58
似乎您正在使用php
填充$data
.因此,您必须将字符集设置为UTF8
(即SET NAMES 'utf-8';
).例如,如果您使用的是mysqli
,则代码将如下所示:
It seems you are using php
to populate $data
. So you have to set charset as UTF8
(i.e. SET NAMES 'utf-8';
). For example if you were using mysqli
, your code would be like this:
<?php
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
mysqli_set_charset($conn,"utf8");
或者如果您使用的是PDO
或此答案. com/a/16575294/1922137>已弃用的mysql
.此外,不要忘记使用utf8-persian-ci
集合.
Or use this answer if you were using PDO
or this one for deprecated mysql
. Moreover, do not forget to use utf8-persian-ci
collection.
在html
中,如果您有表单,请将accept-charset
设置为UTF-8
:
In your html
if you have a form, set the accept-charset
as UTF-8
:
<form action="" accept-charset="UTF-8">