Opened 3 years ago

Last modified 2 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

  1. Set below configuration in your CKEditor test page
    CKEDITOR.replace( 'editor1', {
    	//entities_processNumerical : 'force'
    	entities_additional : '#128247'
    } );
    
  1. 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:

Change History (5)

comment:1 Changed 3 years ago by Jakub Ś

Status: newconfirmed

comment:2 Changed 3 years ago by Jakub Ś

Cc: loominade added

comment:3 Changed 3 years ago by Jakub Ś

#14587 was marked as duplicate.

comment:4 Changed 2 years ago by Jakub Ś

#17018 was marked as duplicate.

comment:5 Changed 2 years ago by Marek Lewandowski

Priority: NormalNice to have (we want to work on it)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy