我尝试插入键盘以外的双引号。
前任:
陈述:艾希礼正在准备考试。在她的评论中,她注意到“语义”表示“意义”,并思考这与语义记忆的关系。第二次审查显示她
插入mysql数据库后,它被转换为以下内容:
艾希礼正在学习准备考试。在她的评论中,她注意到-欧元œ语义-欧元表示-欧元œ含义-欧元,并思考这与语义记忆的关系。一个
我已经将所有的表和数据库转换成utf-8排序规则,并且对utf-8也使用了元标记,但没有成功。有人能确认这个问题吗。
发布于 2013-10-09 09:39:55
我总是这样做:
$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>https://stackoverflow.com/questions/19268254
复制相似问题