CKEditor字符集 [英] CKEditor charset

查看:100
本文介绍了CKEditor字符集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Web应用程序更新为使用UTF-8而不是ANSI.

I updated my web app to use UTF-8 instead of ANSI.

我采取了以下措施来定义字符集:

I did the following measures to define charset:

mysql_set_charset("utf8"); // PHP
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> // HTML
utf8_general_ci // In MySQL

我还编辑了CKEditor配置以删除htmlentities,因为我需要正确的字符(即é而不是&eacute;)来进行MySQL全文搜索.

I also edited the CKEditor config to remove htmlentities because I need the correct character (i.e. é and not &eacute;) for MySQL fulltext search.

config.entities = false;
config.entities_latin = false;

在数据库(phpMyAdmin视图)和普通文本字段输出(HTML,<input><textarea>)上,一切看起来都很好(我看到的是é,不是&eacute;,不是é,是的)

In the database (phpMyAdmin view) and on normal text fields output (HTML, <input> or <textarea>), everything looks fine (I see é, not &eacute;, not é, yay).

但是,CKEditor在编码方面遇到了一些麻烦.有关从数据库获取的相同字段,请参见附件图像,该图像显示在文本区域中,然后显示在由CKEditor替换的文本区域中:

However, CKEditor has some trouble with the encoding. See attached image for the same field taken from the database, displayed in a textarea, then in a textarea repalced by CKEditor:

这似乎在CKEditor JavaScript代码中(可能是固定的字符集),但是我在配置中找不到它.同样,由于é在正常的HTML中正确显示(实际的UTF-8 é,而不是&eacute;é),所以我很确定这不是错误的PHP/MySQL查询(但我可能是错误).

This seems to be in the CKEditor JavaScript code (probably a fixed charset), but I can't find it in the config. Again, since the é displays correctly in normal HTML (real UTF-8 é, not &eacute; nor é), I'm quite sure it's not the PHP/MySQL query that's wrong (but I might be mistaken).

这似乎是对UTF-8文本应用htmlentities(默认情况下以Latin-1编码)的症状.可以使用htmlspecialchars或指定字符集("utf-8"),但我不知道在CKEditor中可以在哪里修改它.

This seems like a symptom of applying htmlentities, which by default is encoded in Latin-1, on UTF-8 text. There is either a possibility of using htmlspecialchars or to specify the charset ("utf-8"), but I don't know where to modify that in CKEditor.

推荐答案

我的方法是错误的,而不是CKEditor的.正在寻找错误的文件,并错过了htmlspecialchars上的UTF-8编码.

It was my approach that was wrong, not CKEditor's. Was looking in the wrong file and missed the UTF-8 encoding on a htmlspecialchars.

这篇关于CKEditor字符集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆