'+'字符未通过 CKEditor/PHP/MySQL/HTMLPurifier 保存
我正在尝试让 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 的做法是否正确,但诸如 α 之类的字符正在工作......但由于某种原因,文本中的任何“+”都会消失。
有什么想法吗?
I am trying to get UTF-8 encoding working with CKEditor/PHP/MySQL/HTMLPurifier.
I have converted the character sets of the database tables/fields to utf8-unicode-ci.
I have set the following in the ckeditor config:
config.entities = true;
config.entities_latin = true;
config.entities_greek = true;
config.entitles_processNumerical = true;
And PHP is purifying the HTML with HTMLPurifier with the default settings.
I'm not sure if I'm doing the right thing for trying to accept UTF-8, but characters such as α are working... but for some reason, any '+' in the text just simply disappears.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保在发布请求之前对文本进行 urlencode 编码。
如果您不对文本进行“urlencode”,则“+”字符将被视为空格。
如果您对文本进行 urlencode,则“+”字符将类似于:“%2B”。
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'.
我在发布请求之前对文本进行了不必要的 urlencode,而 jQuery/AJAX 已经对其进行了编码。删除了 javascript encode() 和 PHP urldecode() 并解决了问题。
I had unnecessarily urlencoded the text before the post request, while jQuery/AJAX was already encoding it. Removed the javascript encode() and the PHP urldecode() and it fixed the problem.
对于 CKEditor 3.x 及更高版本以及 php 表单,请尝试此
Manos The Greek
For CKEditor 3.x and greater and for php forms try this
Manos The Greek