0
votes

I have an CKeditor box which upon submission converts special characters to html codes for example: ' becomes '

If there is a ' character in an image alt text or any other html attribute, it doesn't escape and thus, breaks some of my functions. Is there a way around this?

I've not made any modifications to configuration etc. it's the standard setup for CKEditor.

Is there a way to overcome this? Any adjustments would need to be made server side (php).

CKEditor auto escapes certain characters so it works with javascript, but the function they have to auto escape characters ignores html attributes for some reason. An image alt called "I'm Dancing" would break it.

Basically I have an input form, which collects the data in the fields and sends it to the database just fine. But when I want to use my edit form (which auto-populates the CKEditor with the database contents), the javascript to set the text to the CKEditor fails because of the problem mentioned above. The text originally came from CKEditor and is being returned to CKEditor from the database for editing.

1
what queries you are talking about? SQL queries? - Your Common Sense
yes, but before that it breaks the AJAX parameters string and some other javascript processing I have. I've not touched regex ever, so I've no idea how to replace a character such as ' with ' throughout my code. However, what I was hoping to target here was the cause for these being there at all. I'm confident I could use a regex to replace the character before it hits javascript, but I shouldn't have to should I? CKEditor should take care of this. - Dan Hanly
dunno about CK but broken SQL queries it completely your own fault. - Your Common Sense
thanks for the constructive advice @Col - I actually haven't gotten as far as writing the SQL Query yet, it breaks my javascript BEFORE the query - Dan Hanly
I said query but I meant function - It's early, don't judge ;) - Dan Hanly

1 Answers

0
votes

I had a similar problem with backround images once. I fixed it with htmlentities()