php - 尽管尝试了所有方法,mysql表仍然显示小黑色问号

标签 php html mysql utf-8

我在mysql表中复制并粘贴了一段内容。表格中的许多其他段落都显示正常,但这一段落有很多黑色背景问号代替撇号或单双引号。我在元标记中有 utf-8。令人惊讶的是 str_replace 也不起作用。这个引号(')引起了很多麻烦,无法使用 str_replace 将其替换为(')。我已经尝试过$story=str_replace("’","'",$story);$story=str_replace("\’","\'",$story); .我一直在寻找解决方案,但似乎没有一个有效。

最佳答案

utf-8 无法识别智能引号字符。您必须使用字符代码

$text = str_replace(chr(145), "'", $text);    // left single quote
$text = str_replace(chr(146), "'", $text);    // right single quote
$text = str_replace(chr(147), '"', $text);    // left double quote
$text = str_replace(chr(148), '"', $text);    // right double quote

关于php - 尽管尝试了所有方法,mysql表仍然显示小黑色问号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42770354/

相关文章:

javascript - 如何知道是否在 src ="..."中调用了 php 文件?

php - 如何在 do-while 循环中回显所选项目?

php - 针对这种特殊情况执行sql操作

php - Symfony2 - 如何在 findBy 中搜索 json_array 字段

html - div跳出短名称的header

PHP mysql 多选查询不工作

html - IE中div高度和宽度的问题

javascript使函数参数动态化

java - 将查询结果打印到jsp表 Java Spring MVC jsp

mysql - sql语句中的减法