Reputation: 916
I have the following code that correctly generates the CKEditor:
<script>
$(function(){
$("#newWrite_body").ckeditor({
extraPlugins : 'autogrow',
autoGrow_maxHeight : 800});
});
</script>
Then I grab some text from a web page, paste it into the editor, and alert the text back upon submitting it shows:
<p>
<b>Fort McKay, Alberta (CNN)</b> -- Celina Harpe was 7 when her grandfather
made a prediction that would forever change her life.</p>
<p>
"I won't see it, I'm too old now, but it's going to be
really bad," she recalls him saying on a warm summer night after
returning from a moose hunt. The two were standing on a hill that overlooks
the birch-and-spruce-lined river here in far northwest Canada.</p>
But when I echo
it back from the PHP code before the insert, it is reduced to:
<p>
<b>Fort McKay, Alberta (CNN)</b> -- Celina Harpe was 7 when her grandfather
made a prediction that would forever change her life.</p>
<p>
Apparently the special characters are being dropped. All my attempts to escape them and/or convert them have been futile.
What is the proper way to convert these from CKEditor's text to a POST-able value in PHP?
Upvotes: 0
Views: 747
Reputation: 916
I finally found the answer. There is a Javascript built-in function called "escape". So this worked:
var text = escape(str);
// THEN POST STRING VIA AJAX
And this is with ajax.
Upvotes: 1
Reputation: 6255
There's a config setting inside ckEditor called CKEDITOR.config.htmlEncodeOutput
That may be what you want.
ckEditor Configuration Documentation
Upvotes: 0