What's a 3D doing in this HTML?
Asked Answered
D

2

347

I'm trying to duplicate a mailer I got into my gmail by taking a look at its code. I see a lot of this in multiple source viewers:

 <td style=3D"border-bottom: 1px dotted rgb(153,157, 147); border-top: 1px solid rgb(28, 140, 78);" width=3D"90">=A0</td>
 <td style=3D"border-bottom: 1px dotted rgb(153,157, 147); border-top: 1px solid rgb(28, 140, 78);" align=3D"right" width=3D"110">

Is 3D some sort of mail rendering thing I don't know about?

Dwayne answered 25/10, 2010 at 15:23 Comment(1)
PHP has a method for converting a quoted-printable string to an 8 bit string php.net/manual/en/function.quoted-printable-decode.phpProfess
L
485

It's an email encoding system called "quoted-printable", which allows non-ASCII characters to be represented as ASCII for email transportation.

In quoted-printable, any non-standard email octets are represented as an = sign followed by two hex digits representing the octet's value. Of course, to represent a plain = in email, it needs to be represented using quoted-printable encoding too: 3D are the hex digits corresponding to ='s ASCII value (61).

Lanchow answered 25/10, 2010 at 15:27 Comment(10)
Yup. You should see Content-Transfer-Encoding: quoted-printable in the headers if QP is used.Adversaria
Interesting! Do I need to incorporate that into my email template, or will it be ok without it?Dwayne
@melee: Don't write in QP by hand (i.e., your template should use =, not =3D). :-) If your email software needs to use QP, it'll convert automatically.Lanchow
Saving you the inevitable search for a decoder: motobit.com/util/quoted-printable-decoder.aspRelique
In my case it was the use of one character in the email message that caused it to change Content-Transfer-Encoding. Replacing — with - solved it.Guadalupeguadeloupe
@Stephen, In the past there are no hex viewers, only text viewers.Aksoyn
To decode, one can use the Python standard library's quopri.decodestring(s)Dimeter
This is why if you send an email in a non-Latin language such as Japanese, it will be encoded that way too! For example sending こんにちは results in = =E3=81=93=E3=82=93=E3=81=AB=E3=81=A1=E3=81=AF at the destination, which is quoted-printable encoding on top of UTF-8 encoding.Cognomen
If you are using PHP you can use quoted_printable_decode($htmlmsg) to remove the =xx and replace it with the right stuff.Bromine
This one works well too: webatic.com/quoted-printable-convertorWhiten
R
-5

Folks from Google using Laravel, you can stop the Mail facade from adding all this weird 3D stuff by setting your encoder to raw:

$message->setEncoder(new Swift_Mime_ContentEncoder_RawContentEncoder);
Rousing answered 12/4, 2021 at 19:21 Comment(3)
An explanation?Inclinatory
Edit your answer adding the explanation you wrote in the comment, and I will upvote it.Inclinatory
This will force laravel to send the mail in 8bit encoding instead of the base64 required for "quoted-printable", so it won't encode "quoted-printable", so the 3D characters will not be added. The problem here isn't how it's send, but how the receiver interprets the mail. Most likely due to missing headers in the e-mail.Chervil

© 2022 - 2024 — McMap. All rights reserved.