CKEditor converts HTML entities back to angled brackets when coming from a database
While trying out some syntax highlighting plugins for CKEditor (to start this new blog ;) ) I noticed that CKEditor has a problem when you like to display < and > (needed for code examples in HTML).
CKEditor handles angled brackets the right way when you create a new post and automatically converts them to their corresponding HTML entities < and >. But when you save the post to a database and load the content from a database (or JSON, etc.) back to CKEditor, all HTML entities for angled brackets (< and >) are converted back to < and >. So when you like to edit a post all the HTML examples are suddenly empty.
But there's a workaround for this problem. Convert & to & in your backend before handing over the string to the textarea of CKEditor.
//PHP example $string = strtr($string, array( '<' => '&lt;', '>' => '&gt;', ));
This bug exists for a while in CKEditor and is still not fixed (by the date of this blog post).