This question about Using an extension: Answered

Using WYSIWYG with 'greater than'

Hi, just moving from T* to foswiki, and trying to map existing topics, I've just noticed some strange behviour that I hope you can help with:

If I type the following into a topic:

one > zero

I get different TML saved with raw and WYSIWYG editors.

If I use the WYSIWYG editor, I get:
one > zero

If I use raw, I get:
one > zero

Of course, these render the same, unless the '>' is closing a html tag which started inside a variable setting. In this case, the whole tag is broken, and you get ugly misformed HTML when you edit and save with the WYSIWYG editor.

Is there a good reason why the '>' has to be translated to '& gt;' (no space) when the WYSIWYG editor is used? Can you think of a way to avoid this?

Thanks for your thoughts.


Well, nobody had any thoughts, so we have implemented a translation in beforeSaveHandler, and something similar in TinyMCE when you switch from WYSIWYG to Wiki Text mode. Seems to work for us. If it's interesting to anyone, drop a comment here.


TinyMCE always tries to produce something resembling valid XHTML-strict conforming output.

I would suggest trying to tell TinyMCE to use entity_encoding : "raw" as in Tasks.Item8085.

That task is about international character encoding issues, where the setting prevented TMCE from converting native high-bit characters into their HTML entity equivalents, and solved the problem.

Improving internationalisation/encoding support is a high priority for the WysiwygTaskTeam, but in your case I suspect TMCE may convert the brackets to entities regardless of the encoding=raw setting.

The reason is that stray angle brackets are considered dangerous in XHTML produced for the web. While most browsers deal with it gracefully, it's generally accepted that they may not be well handled by non-browser agents which have naive parsers expecting valid documents.

Of course this is all well and good for CMS systems using TinyMCE's output directly for consumption on the web, but in your case has gotten in your way in Foswiki where the output of TMCE is post-processed again (converting < to &lt;) before being rendered to a browser anyway.

If you try entity_encoding : "raw", please let us know how it went.

-- PaulHarvey - 17 Feb 2010

QuestionForm edit

Subject Using an extension
Extension WysiwygPlugin
Version Foswiki 1.0.9
Status Answered
Topic revision: r3 - 17 Feb 2010, PaulHarvey
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy