Paste HTML character entity references like < is immediately decoded by macro body editors

If you paste an HTML character entity reference into a macro body editor it is immediately decoded.
https://dev.w3.org/html5/html-author/charref
This happens only in the OLD page editor.

For example, if you paste &lt;label&gt; into a Code Block macro body the character entity references are immediately decoded and it becomes <label>.

We noticed it because we have our own macro and customers paste HTML code into it.

Everything works fine if a user TYPES (not paste) HTML entity character references into a macro body. Those references are NOT decoded.

A few years ago the opposite problem was noticed (HTML characters were being encoded to become HTML character entity references: Solved: Ampersand decodes in "&amp;" in code block
That problem was fixed about 5 months ago:
[CONFCLOUD-59800] Code Block macro: wrong formatting shown for ampersand - Create and track feature requests for Atlassian products.

I’m going to guess that when CONFCLOUD-59800 was fixed it went too far and now some event handler for the macro editor is decoding when it shouldn’t.

Our workaround is that we double-escape HTML character entity references before pasting them into a macro body but that’s going to be tedious and error prone even if we use a tool to do the double-escape.

1 Like