Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12034 closed Bug (invalid)

Possible issue with build system; string literal corrupted?

Reported by: enco Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

Hello,

I already filed an issue for this on github: https://github.com/ckeditor/ckeditor-releases/issues/19 For your convenience, I'll re-post the thread here:


It seems that the \u200B string in core/selection.js gets corrupted during the build / minifying process: https://github.com/ckeditor/ckeditor-dev/blob/master/core/selection.js#L123

var fillingChar = element.getDocument().createText( '\u200B' );

Compare this to the current release version where this line becomes

i=l.getDocument().createText("​")

I stumbled upon this when debugging a strange issue on Google Chrome with question marks being inserted into the editor field every time I changed the text formatting (without active selection) or pressed Shift + Enter to insert a linebreak. In my downloaded version of ckeditor.js, this line looked like this:

i=o.getDocument().createText("?");

Sure enough, replacing the question mark by "\u200B" did the trick for me.

There seem to be a few bug reports mentioning this issue [1], but apparently no one was able to identify the problem conclusively. So I hope this helps.

[1] e.g. http://ckeditor.com/forums/Support/Question-Mark-after-pressing-button-toolbar


This is what Reinmar replied on github:


What build/minifying tools do you use? CKBuilder does not have this problem, because then millions of users would report it to us. So this is something specific for small number of cases. Are you sure you didn't broke the encoding? The a zero width space is replaced with question mark it's usually because of wrong files encoding. It may be cause by wrong server settings, your builder/minifier saving them incorrectly, etc.

BTW. This is not the right place to report bugs, unless they are related directly to this repository. Bugs related to CKEditor and its builder should be reported on http://dev.ckeditor.com.


So here's my reply:

Sorry if I wasn't clear enough and sorry if I posted this in the wrong place. I'm not building CKeditor myself, I'm just comparing the source tree with the release code on github and with the official download on ckeditor.com. Please compare https://github.com/ckeditor/ckeditor-dev/blob/master/core/selection.js#L123 to the corresponding code in https://github.com/ckeditor/ckeditor-releases/blob/master/ckeditor.js and you will probably see the issue. Unless I'm completely mistaken, the string literal '\u200B' has simply been dropped.

No idea where the question mark in my particular installation came from, but I don't think it is an encoding problem. This is a string literal in the JavaScript code that is never interpreted until the Javascript code is run, so it is not susceptible to encoding issues during transfer of the source code. My guess is that this string literal was somehow interpreted during the build process instead of being taken literally, but I may be wrong.

Thanks for your time.

Change History (3)

comment:1 Changed 5 years ago by Piotrek Koszuliński

Resolution: invalid
Status: newclosed

The string literal was not replaced by an empty string :) It was replaced with the zero-width-space, because \u200b means exactly it. If you copy contents of https://github.com/ckeditor/ckeditor-releases/blob/master/ckeditor.js#L382 to your editor and try to move caret with left arrow key through that visually empty string, you'll notice that you have to press the key twice. So the char is there. Editor could not work without it.

You can see many "?" created if you serve CKEditor files encoded incorrectly. Check that your server sends them in UTF-8. Or if the problem is visible immediately in your system, when you open CKEditor file, then I'm afraid you're using some poor code editor, which does not open files with BOM correctly. I've just checked that ckeditor.js from the releases repository contains BOM and the zero width space in correct places.

comment:2 Changed 5 years ago by enco

Thanks for the explanation, but the point still remains: is this replacement really intentional? Because if the escaped string was preserved instead of being interpreted and replaced during the build process, there wouldn't arise any problems even with dumb editors or improper server configurations. I would think that that's the way it was originally supposed to be. Just saying :)

comment:3 Changed 5 years ago by Piotrek Koszuliński

This is not the only special character. There are also language files with characters that would also be lost in different encodings. Of course basic editor in english might work (although even characters like ndash could explode), but nothing besides that.

So, thanks for idea, but it's not an option.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy