php - 将 t 转换为 php 中的撇号
问题描述
我正在从另一个系统中提取一些文本,该系统已从 Word 或其他系统中粘贴了文本。
有时撇号与这些字符一起显示。我可以进行搜索和替换,但我确信这不是最好的方法,因为可能还有其他字符的行为方式类似。
我看过这个问题 [ Getting ’ instead of an apostrophe(') in PHP但我尝试过的一切仍然不起作用。
我的简化代码是这样的。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8_unicode_ci" />
<title></title>
</head>
<body>
<?php
$s = "It’s Getting the Best of Me";
echo $s . "<br>";
$notGiberish = mb_convert_encoding($s, "HTML-ENTITIES", 'UTF-8');
echo $notGiberish . "<br>";
echo html_entity_decode(mb_convert_encoding($s, "HTML-ENTITIES", 'UTF-8')) . "<br>";
?>
</body>
如果必须,我将搜索和替换。
谢谢
解决方案
推荐阅读
- r - 强制 is.unsorted() 为 false
- android - 如何使用 Apache poi 在 android studio 中获取图片格式 .docx
- vue.js - Highcharts-vue - 调用我自己的工具提示标签格式化程序函数
- c - 将 rand() 用于加密不安全的随机数是否可以接受?
- security - 去中心化的点对点身份验证
- php - 在 Laravel 中活跃的动态 li 类
- android - 在 Toast 之上的 Android Toast - 当顶部消失时底部的底部仍然存在
- sql - 如何解决 UPDATE 语句的条件?
- c++ - 如何忽略 gcc 5.x 中未使用的静态变量?
- react-redux - Redux - 限制一个动作所以不经常触发