loominade
loominade

Reputation: 1058

Disable conversion of html entities in CKEditor

I have a textarea containing a text like:

Foo 📷 Bar

When I apply CKeditor on that area it correctly displays it as:

Foo 📷 Bar

Which is fine.

But unfortunately it convertes 📷 to 📷 while doing so.

Can I disable this somehow?

Edit

I tried Enities addon with the setting entities_additional set to true.

This setting actually breaks the 📷 character into �� which is invalid. I'm sure this is a bug and the Enitiy Plugin can't handle multibyte characters.

Upvotes: 2

Views: 8378

Answers (3)

Dinesh Sharma
Dinesh Sharma

Reputation: 99

I Got a solution, Please use "htmlspecialchars" like echo htmlspecialchars( $content );

This will convert "&" to "&amp ;".

Upvotes: -1

Grant
Grant

Reputation: 2441

I had a similar problem, my textarea using CKEditor was adding the encoded HTML tags as plain text, so when I displayed the output on a web page the HTML tags showed up as: <p> in the page and not

which one would not normally see in the browser (one would only see result, the actual paragraph spacing).

I tried all combinations of:

config.entities = false

config.htmlEncodeOutput = false;

config.entities = true

config.htmlEncodeOutput = true;

Nothing worked until I realised that I was using the PHP htmlspecialchars() in my form to parse the textarea field.

By removing htmlspecialchars() in my form for that field and setting:

config.entities = true; 

I resolved the problem.

Upvotes: 1

j.swiderski
j.swiderski

Reputation: 2445

By default CKEditor should translate entities with either this entities_processNumerical : force or this entities_additional:'#128247' setting.

This is however not the case for 4-byte entities as they get destroyed most likely by replace method. I have reported this issue here: https://dev.ckeditor.com/ticket/14588

Upvotes: 1

Related Questions