Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Tiny MCE (not) replacing characters


Reply


1597 Views

Avatar
Alex S

Community Member, 30 Posts

1 September 2009 at 4:03am

Hey,

I've just noticed that TinyMCE doesn't seem to be replacing double-quote characters with the correct HTML alternative. What I would expect to happen is, having typed this "Hello World" into the CMS Tiny MCE would convert accordingly to "Hello World" in the source code. However, the double quote character remains (and stops the page validating as XHTML).

I had a further look and tested inserting the correct HTML directly into the source editor, it seems to have the opposite effect to what it should be doing? It converts my " back to the double quotation character in the source code.

It correctly changes the "less than" and "greater than" characters to their respective HTML.

I've tried adding the following to "_config.php": "HtmlEditorConfig::get('cms')->setOption('verify_html', 'true'); // turn on html validation" to attempt to force some validation, sadly, no joy.

I found some code in the "/jsparty/tiny_mce2/tiny_mce_src.js" file (line 2206):

encode : function(s) {
         return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) {
            switch (c) {
               case '&':
                  return '&amp;';

               case '"':
                  return '&quot;';

               case '<':
                  return '&lt;';

               case '>':
                  return '&gt;';
            }

            return c;
         }) : s;
      }

Which looks like it's going to do the right thing.

Have I missed something? Is this disabled somewhere? I figure I've just not dug down far enough yet but I can't think where else to look, does anyone have any suggestions?

Cheers,

Alex