When you manually Q-encode, some non-special characters become special

SanfordWhiteman
Level 10 - Community Moderator
Level 10 - Community Moderator

From earlier posts and experience, you know:

  1. (1) All non-ASCII characters in a Subject line must be Q-encoded — not a Marketo rule but a rule for email in general.
  2. (2) Marketo automatically encodes most characters for you, but for emojis you must Q-encode them yourself.
  3. (3) If you manually Q-encode any characters, you must manually handle all of them (Marketo switches to “manual only mode”).

A 4th point might be unfamiliar: if you choose to Q-encode an entire sentence, a few characters that used to not require encoding suddenly do!

 

Those are the reserved characters in Q-encoding: = ? _ plus spaces and tabs. Like the spec says:

 

A real-world case

Such was the problem encountered by a Nation user who was trying to use the Lightbulb emoji 💡. They got the emoji itself right, but they added a question mark and space inside the encoded word[1] and forgot to encode those:

=?UTF-8?Q?Schon gewusst? =F0=9F=92=A1 Spannende Insights?=

 

(Not sure exactly how they assembled this Subject line, by the way — probably hand-editing, which is prone to error!)

 

But here’s the notable part: the problem only revealed itself in Apple Mail for iOS. If you don’t test in that client, you won’t know how bad it looks:

 

 

Apple is absolutely correct that it’s bad Q-encoding, and they’re right to break the display. Other mail clients are more forgiving, but you should always build to the strictest standard and don’t rely on clients being looser.

 

Encoding correctly

We know that this is wrong:

=?UTF-8?Q?Schon gewusst? =F0=9F=92=A1 Spannende Insights?=

 

But what’s right? Well, it depends on how much you want to put between the =? and ?=.

 

Option A: If you want to keep encoding the whole Subject without taking any shortcuts, do it like this, with =3F for the question mark and =20 for the space:

=?UTF-8?Q?Schon=20gewusst=3F=F0=9F=92=A1=20Spannende=20Insights?=

 

Option B: If you want to encode the whole Subject but use the special shortcut _ for the space to increase readability:

=?UTF-8?Q?Schon_gewusst=3F=F0=9F=92=A1_Spannende_Insights?=

 

Option C: Just encode the emoji, move everything else outside:

Schon gewusst? =?UTF-8?Q?=F0=9F=92=A1?= Spannende Insights

 

Whether you choose A, B, or C, you’ll get the right result:

 
NOTES

[1] “Encoded word” is the technical name for the characters between =? and ?=. Regardless of whether it’s a single emoji or multiple words in regular parlance, it’s still called a “word” in Q-speak.

320
0