I'm having some problems with HTML encoded data sent from an FCKEditor via form POST. The character '>' is being encoded as '>' sometimes, and other HTML entities are encoded as well, but not always. The behavior is repeatable on the FCKEditor nightly samples page too, and here's how to see it:
1. Go to the nightly samples page URL: http://www.fckeditor.net/nightly/fckedi ... fault.html
2. Choose any of the PHP samples. It works the same (badly) on all of them.
3. Without changing any of the styles, enter the text '< & > "' between 'is' and 'some', so the plain text would read This is < & > " some sample text.
4. Submit the form. You get a new browser window with the data as "This is < & > " some..." This is the problem. All of the samples have HtmlEncodeOutput set to the default value of 'false' so that all of those characters should NOT be encoded as html entities. Plain old <textarea> form fields do no encode those characters for the POST.
5. Now go back to the form, and click on the "Source" button in the FCKEditor toolbar. You'll see that the text indeed shows "This is < & > " some...".
6. While in Source mode view, remove those encoded symbols and put in the original symbols of '< & > "'. Leave the FCKEditor in Source mode and Submit the form. The new browser window now shows the data being posted as 'This is < & > " some..." which is what it should be.
The short of it is, while in Source mode the text characters are not encoded as HTML entities for POST. While in normal mode (the usual mode for editing with FCKeditor) then the entities ARE encoded for POST. Even clicking back and forth between Source and normal mode encodes the text as HTML entities, although at least it does not keep re-encoding them over and over again on each switch between Source and normal mode.
How am I supposed to know whether I need to run the post'ed data through html_decode or not? It depends entirely on what mode the user had FCKeditor in when they submit the form. This seems like a big glaring bug in FCKEditor 2.5.x.
Wed, 02/20/2008 - 22:02
#1