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: https://community.atlassian.com/t5/Confluence-questions/Ampersand-decodes-in-quot-amp-amp-quot-in-code-block/qaq-p/795606
That problem was fixed about 5 months ago:
https://jira.atlassian.com/browse/CONFCLOUD-59800

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