Re: character issue in From field when using token

Kevin_Stinson
Level 3

character issue in From field when using token

Hello I am having and issue with adding a token to the from field.
The names I am using contains special characters: ö ä û etc

The tokens work in the body of the email but not the "From" field.

In the database I have tried switching the characters to from ö to ö and %C3 %B6 but with the same result not displaying the correct character.
See image:

token character issue.JPG

 

In field management "HTML Encode Tokens in Emails" is checked.

Kevin_Stinson_0-1588018776998.png

thanks for any help getting these to display correctly,

Kevin.

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: character issue in From field when using token

You need Q-encoding here, HTML encoding has no significance in headers.

 

Because it's a token, you'll need Velocity to encode it.

 

I can provide the code shortly but in the meantime pls read about Q-encoding in my posts.

Kevin_Stinson
Level 3

Re: character issue in From field when using token

Are you saying you can't use a regular token here if a name has special characters?

{{lead.external_fullname:default=Sales XYZ Company}}

I have about 20 sales guys for this region with various special characters.

SanfordWhiteman
Level 10 - Community Moderator

Re: character issue in From field when using token

Are you saying you can't use a regular token here if a name has special characters?

{{lead.external_fullname:default=Sales XYZ Company}}

I have about 20 sales guys for this region with various special characters.


You can use a regular {{lead.token}} directly even if the value has non-ASCII (let's not say "special," that's too vague) characters. Marketo will automatically Q-encode it. But not if you also have HTML Encode Tokens in Emails checked.

 

If you have HTML Encode checked then the value is HTML-encoded everywhere, including in the headers where it is inappropriate, as well as in the Text part of emails where it's also wrong.

 

If you need the same value to be used in Q-encoded, unencoded and HTML-encoded forms, then you can't have HTML Encode on. You need the checkbox off (that means it'll work in headers and in Text) and then you need Velocity to HTML-encode it when used in the HTML part.

 

Or you could have a separate field and keep the values in sync, one checked and one unchecked, though obvs. this is tough to scale if you have lots of fields that need to be output in both formats.

Kevin_Stinson
Level 3

Re: character issue in From field when using token

Hi Sanford

Thanks for the explanation. 

But if I go the Velocity route to HTML-encode it. I could not understand how to do it in a my.token.

I looked at your blog page which I believe you were referring to: https://blog.teknkl.com/yes-you-can-use-emojis-in-marketo-subject-lines/

Would you have a sample that could help me out?

thanks.

 

SanfordWhiteman
Level 10 - Community Moderator

Re: character issue in From field when using token

But if I go the Velocity route to HTML-encode it. I could not understand how to do it in a my.token.


${esc.html($lead.YourFieldName)}

 

Why do you need it HTML-encoded, specifically?

Kevin_Stinson
Level 3

Re: character issue in From field when using token

We unchecked the "HTML Encode Tokens in Emails" checkbox for this field and it is now working for us in both the "From" field with a regular lead.token and in the email body.

 

I found this link that said it was automatically turned on at some point in a release.

https://nation.marketo.com/t5/Product-Discussions/HTML-Encode-Tokens-in-Emails-from-latest-release-b...

I guess it was something we did not take notice of until now as we are rolling out Marketo to more of our European countries.

 

Thanks Sanford for pointing me in the right direction.

SanfordWhiteman
Level 10 - Community Moderator

Re: character issue in From field when using token

So you didn't need to HTML encode - that was my question.

 

You should also read https://blog.teknkl.com/velocity-looking-good-saying-nothing/ to understand how the option works.