What is the HTML encode setting useful for? | Community
Skip to main content
Grégoire_Miche2
New Participant
April 19, 2016
Solved

What is the HTML encode setting useful for?

  • April 19, 2016
  • 1 reply
  • 2100 views

Dear all,

We have the possibility, in admin -> field Management, to activate the "HTML encode setting".

Once enabled, all fields can have this setting activated or not, as here:

Does anyone knows the impact of this setting ?

Thx in advance,

-Greg

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

If the token is meant to be output into raw HTML and is not otherwise validated, it's possible for the result to contain reserved character sequences that can only be solved by preemptively HTML-encoding.

For example, the string

     You &me; him &her;

will create parse errors because the &*; sequences are parsed as character references. Encoding the & to & removes the confusion. IIRC, Marketo outputs decimal references, but it's the same idea.

I've definitely seen problems that are solved by HTML-encoding, but it can't solve everything. And if you do choose to encode, you have to remember that parsing the tokens as JS strings won't work anymore. It's an either/or.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
April 19, 2016

If the token is meant to be output into raw HTML and is not otherwise validated, it's possible for the result to contain reserved character sequences that can only be solved by preemptively HTML-encoding.

For example, the string

     You &me; him &her;

will create parse errors because the &*; sequences are parsed as character references. Encoding the & to & removes the confusion. IIRC, Marketo outputs decimal references, but it's the same idea.

I've definitely seen problems that are solved by HTML-encoding, but it can't solve everything. And if you do choose to encode, you have to remember that parsing the tokens as JS strings won't work anymore. It's an either/or.

Grégoire_Miche2
New Participant
April 19, 2016

Hi Sanford,

Thx !

-Greg