kalys / bamboo_ses

AWS SES adapter for Bamboo
MIT License
35 stars 24 forks source link

Set encoding of part when non ascii given #36

Closed marocchino closed 3 years ago

marocchino commented 3 years ago

I think this modification will also display non-ASCII characters. Thank you.

travelmassive commented 3 years ago

Have just spent some time testing this patch. Thanks for contributing this.

I can confirm this fixes an issue with incorrect character display in Gmail's web client. In my testing of bamboo_ses, I discovered Gmail (browser client) sometimes renders emojis as foreign characters if charset: "UTF-8" is not sent.

For example, 🎉 emoji is rendering as 脂 in Gmail in specific (and repeatable) cases. This appears to trigger a quirk in Gmail where in the absence of the charset being defined in the multipart header, it guesses it incorrectly. Setting the charset to "UTF-8" fixes the problem.

What this PR does:

Emails containing non-ascii (eg, emojis) get a UTF-8 charset in the multipart Content-Type header:

Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Without this patch, we're missing the charset:

Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

Thanks to @marocchino for the PR, and here's my +1 for accepting it

kalys commented 3 years ago

I'll release new version within 2 weeks