0

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

我已将数据库表/字段的字符集转换为 utf8-unicode-ci。

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

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

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

我不确定我是否在尝试接受 UTF-8 时做正确的事情,但是诸如 α 之类的字符正在起作用……但由于某种原因,文本中的任何“+”都会消失。

有任何想法吗?

4

3 回答 3

0

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

于 2010-08-04T10:00:39.097 回答
0

对于 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);

希腊人马诺斯

于 2010-11-16T13:13:54.443 回答
0

Make sure that the text is urlencoded before post request.

If you do not 'urlencode' the text then the '+' character will be treated as space. If you urlencode the text then the '+' character will look like: '%2B'.

于 2010-08-02T06:43:54.290 回答