在 mysql 中插入键盘上没有的双引号和单引号


Inserting double quotes and single quotes not on keyboard in mysql

我试图插入键盘以外的双引号

例如:

声明:阿什利正在为考试而学习。在她的审查中,她注意到"语义"表示"意义",并思考这与语义记忆的关系。第二次审查显示她

插入 mysql 数据库后,它会转换为以下内容:

阿什利正在为考试而学习。在她的审查中,她注意到"语义"表示"意义",并思考这与语义记忆的关系。一个

我已经将所有表和数据库转换为 utf-8 排序规则,并且还对 utf-8 使用了元标记,但没有成功。有人可以确定问题吗?

我总是这样做:

$db = new mysqli('localhost','root','','db');
$cod = $db->query("SET NAMES 'utf8'"); //Set the encoding

这段代码对我有用(刚才(:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ab</title>
<script type="text/javascript">

</script>
</head>
<body>
<?
$db = new mysqli('localhost','root','','test');
$cod = $db->query("SET NAMES 'utf8'");
$result = $db->query("INSERT INTO `test`(`string`) VALUES ('".addslashes("“teststring“")."')");
$result = $db->query("SELECT `string` FROM `test` WHERE string='".addslashes("“teststring“")."'");
$result= $result->fetch_assoc();
echo $result['string'];
?>
</body>
</html>