PostgreSQL 和 Codeigniter 3 中“和”的问题

Problem with ‘ and ’ in PostreSQL and Codeigniter 3

我在一个使用 Codeigniter 3 和 PostreSQL 的项目中工作,就像一个与 CKEDITOR 一起工作的票证系统,用户从 Microsoft Word 粘贴答案,但是“它被插入到数据库为 ’‘ 并且我没有在网站上显示,有没有办法呈现这个,或者将整个文档中的 '' 替换为 ''?

谢谢

编辑

<textarea name="respuesta" id="consulta-body">
<?

if($consulta ->previo){
$chars = htmlspecialchars($consulta->previo, ENT_QUOTES);
echo $chars;
    ?>
</textarea>

这是我试过的,一点都不走运

请尝试以下步骤来解决您的问题,

  1. 在将编辑器内容保存到数据库之前:

    $content = htmlspecialchars($editorcontent, ENT_QUOTES);

  2. 从数据库中检索内容之前:

    html_entity_decode($contentfromdb, ENT_QUOTES);

更新:

要显示从数据库中获取的数据,您需要执行上述步骤中的第 2 步。按如下方式编辑您的代码

<textarea name="respuesta" id="consulta-body">
<?

if($consulta ->previo){
  $chars = html_entity_decode($consulta->previo, ENT_QUOTES);
  echo $chars;
?>

希望对您有所帮助。

我可以从 CKEditor 的角度给你一个提示。

也许您正在使用 config.htmlEncodeOutput = true 这将给出您正在谈论的结果 - &amp;rsquo;。如果您希望在编辑器级别将其更改为 &rsquo;,请将此配置设置设置为 false

已通过使用 ckeditor 中的实体插件修复