22 Votes

TinyMCE: Do not convert Special Characters to Named Entities

Question by Guest | 2015-02-06 at 16:18

I still have a little problem with my TinyMCE HTML Editor. Using formatting and entering numbers or letters from A-Z is working well. But, however, problems arise as soon as trying to type accents, umlauts or other special characters.

For example, instead of writing the characters ä, ö and ü, TinyMCE is writing "ä", "ö" and "ü". So, TinyMCE is using the so-called named entities or named characters known from HTML.

Because on my website, all of my texts are UTF-8 encoded, I do not need those named entities. Rather, they are disturbing because they are making database searches impossible when words are containing a character of this kind.

Is there any possibility to configure TinyMCE in a way, that it is not using the named entities anymore?

ReplyPositiveNegative
4Best Answer4 Votes

You are searching for the option "entity_encoding" which can be set during initializing of TinyMCE:

tinymce.init({
  selector: "textarea",
  entity_encoding: "raw",
  toolbar: "bold italic underline"
});

With setting "entity_encoding" to "raw", all characters will no longer be stored as named entities except the characters " & < and > having a special meaning in HTML.

If "entity_encoding" is set to "named", the named entities such as &auml; are used. With setting "entity_encoding" to "numeric", the Unicode encoding (numeric entities) such as &#228; is used.

By the way, you can use PHP to free your text from the named entities:

html_entity_decode('über'); 

For the opposite effect, you can use htmlentities() and htmlspecialchars().
2015-02-06 at 17:37

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.