Opened 9 years ago
Last modified 8 years ago
#14588 confirmed Bug
CKEditor doesn’t translate 4-byte entities correctly.
Reported by: | Jakub Ś | Owned by: | |
---|---|---|---|
Priority: | Nice to have (we want to work on it) | Milestone: | |
Component: | General | Version: | 4.0 |
Keywords: | Cc: | loominade |
Description
Steps to reproduce
Based on: http://stackoverflow.com/questions/36574026/disable-conversion-of-html-entities-in-ckeditor
- Set below configuration in your CKEditor test page
CKEDITOR.replace( 'editor1', { //entities_processNumerical : 'force' entities_additional : '#128247' } );
- Paste the following text into editor and switch to source (and back) "Foo 📷 Bar"
Expected result
Camera character translated to entity 📷
Actual result
For setting entities_processNumerical : 'force'
you will get ��
in source mode and �� in wysiwyg view.
For setting entities_additional : '#128247'
you will get 📷&undefined;
in source mode and 📷&undefined; in wysiwyg view. The undefined word will be added every time you change modes.
Other details (browser, OS, CKEditor version, installed plugins)
When I checked in code it looks like character is ok in here: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/entities/plugin.js#L152 but gets destroyed here: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/entities/plugin.js#L152. It looks like replace
method is breaking it.
Now, I'm not sure if this is a problem and if replace
method is using charCodeAt
or fromCharCode
but these methods e.g. charCodeAt return codes between 0 and 65535 and this seems to be what is happening here. Every character with code below 65356 is a 3-byte character and is handled properly but starting from 65536 4-byte characters get split into two entities.
Links:
- How to check how many bytes character has: https://mothereff.in/byte-counter
- Characters Map: http://dev.networkerror.org/utf8/?start=60001&end=70001&cols=6&show_uni_int=on&show_uni_hex=on&show_html_ent=on&show_raw_hex=on
- Something that might help: http://stackoverflow.com/a/6242192/4555078
Change History (5)
comment:1 Changed 9 years ago by
Status: | new → confirmed |
---|
comment:2 Changed 9 years ago by
Cc: | loominade added |
---|
comment:3 Changed 9 years ago by
comment:5 Changed 8 years ago by
Priority: | Normal → Nice to have (we want to work on it) |
---|
#14587 was marked as duplicate.