代码之家  ›  专栏  ›  技术社区  ›  David Lawson

“+”字符未通过CKEditor/PHP/MySQL/HTMLPurifier保存

  •  0
  • David Lawson  · 技术社区  · 14 年前

    我正在尝试使用CKEditor/PHP/MySQL/HTMLPurifier使用UTF-8编码。

    我在ckeditor配置中设置了以下内容:

    config.entities = true;
    config.entities_latin = true;
    config.entities_greek = true;
    config.entitles_processNumerical = true; 
    

    PHP正在用默认设置的HTMLPurifier净化HTML。

    有什么想法吗?

    3 回复  |  直到 14 年前
        1
  •  0
  •   Vikash    14 年前

    如果对文本进行URL编码,则“+”字符将类似于:“%2B”。

        2
  •  0
  •   David Lawson    14 年前

    在post请求之前,我对文本进行了不必要的url编码,而jQuery/AJAX已经对其进行了编码。删除了javascript encode()和PHP urldecode()并修复了问题。

        3
  •  0
  •   Manos    14 年前

    对于CKEditor 3.x及更高版本和php表单,请尝试以下操作

    include_once "ckeditor/ckeditor.php";
    // The initial value to be displayed in the editor.
    $initialValue = 'This is a test  - Αυτο ειναι ενα τεστ';
    // Create class instance.
    $CKEditor = new CKEditor();
    // Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
    // If not set, CKEditor will try to detect the correct path.
    $CKEditor->basePath = 'ckeditor/';
    $CKEditor->config['height'] = 450;
    $CKEditor->config['skin'] = 'kama';
    **$CKEditor->config['entities_greek'] = false;**
    $CKEditor->editor('MyEditor',$initialValue);
    

    希腊人马诺斯

    推荐文章