SOLVED

Unwanted encoding of custom fields

Go to solution
Anonymous
Not applicable

We have a custom text field that holds html containing list items and links:

<li><a href='http://marketing.mamsoft.co.uk/v8-certified/certificate/beru.pdf'>Beru certificate</a></li><li><a href='http://marketing.mamsoft.co.uk/v8-certified/certificate/champion.pdf'>Champion certificate</a></li><li><a href='http://marketing.mamsoft.co.uk/v8-certified/certificate/duron.pdf'>Duron certificate</a></li><li><a href='http://marketing.mamsoft.co.uk/v8-certified/certificate/ferodo.pdf'>Ferodo certificate</a></li><li><a href='http://marketing.mamsoft.co.uk/v8-certified/certificate/moog.pdf'>Moog certificate</a></li><li><a href='http://marketing.mamsoft.co.uk/v8-certified/certificate/payen.pdf'>Payen certificate</a></li>

When this field is inserted into an email, it renders correctly in Gmail:

pastedImage_0.png

However, when viewing the online version in a browser, the html is encoded and the field displays as text:

pastedImage_2.png

Viewing the browser source indicates that the field content has been encoded:

pastedImage_4.png

How do we disable the encoding and get the online version to render correctly? We have not enabled encoding of tokens.

pastedImage_5.png

1 ACCEPTED SOLUTION
Justin_Cooperm2
Level 10

We literally were just talking about this in the engineering team. This happens because we have a security feature on all of our landing page infrastructure to ALWAYS html encode tokens when they are replaced on a webpage. It's not possible to override this. The setting you are looking at is only for emails. We are going to put in a change to support non-html encoding these values in the email web viewer for fields that you've specified to not be HTML encoded in your emails.

Justin

View solution in original post

12 REPLIES 12
SanfordWhiteman
Level 10 - Community Moderator

I've found this very easy to work around.  Wrap tokens in containers with an easily findable class.  Then

[].forEach.call(document.querySelectorAll('.encodedHTML'),function(el){

  el.innerHTML = el.textContent;

});

Live demo: http://codepen.io/figureone/pen/4444c0f427cff2f579f3b0a55a2536f7/

Justin_Cooperm2
Level 10

You add that to your emails tho? wouldn't that hurt your deliverability and sender reputation since you have JS in there? I'm talking about when a user clicks "View as webpage" in a marketo email

SanfordWhiteman
Level 10 - Community Moderator
Justin_Cooperm2
Level 10

lol I think you may be just a tad bit more advanced than our average customer

SanfordWhiteman
Level 10 - Community Moderator

True enough, but anyone can use the service! (No one ever pays attention though.)

Dan_Stevens_
Level 10 - Champion Alumni

Sandy, I think you underestimate the number people that do pay attention and value your advice, techniques, fixes, workarounds, etc. immensely!

Jenn_DiMaria2
Level 10

Yes, and there's a bit of fangirling over in the #mykrewe Slack Just sayin'!

SanfordWhiteman
Level 10 - Community Moderator

Geez, I thought I was too old to even be mentioned on Slack. Thanks Dan Stevens​ and Jenn DiMaria​!

Jenn_DiMaria2
Level 10

I pay attention! Your answers have been a godsend to me in many circumstances

Justin_Cooperm2
Level 10

We literally were just talking about this in the engineering team. This happens because we have a security feature on all of our landing page infrastructure to ALWAYS html encode tokens when they are replaced on a webpage. It's not possible to override this. The setting you are looking at is only for emails. We are going to put in a change to support non-html encoding these values in the email web viewer for fields that you've specified to not be HTML encoded in your emails.

Justin

Jenn_DiMaria2
Level 10

Just delete the web version and all is well Kidding!

Maybe try recreating the field as a string? If you're hard coding it anyway, it's worth a try. I know the rich text editor in email does some weird encoding things on the text version of emails, so maybe this is something similar.

SanfordWhiteman
Level 10 - Community Moderator

Do you also have it disabled ​at the field level?