gene1wood / birch-girder

An Email Interface for GitHub Issues
GNU General Public License v3.0
9 stars 3 forks source link

UTF-8 characters in initial_email_reply cause problems #32

Closed gene1wood closed 3 years ago

gene1wood commented 3 years ago

If initial_email_reply contains UTF-8 characters, then these lines cause an error

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 361: ordinal not in range(128)

This could be fixed by changing these to

    part1 = MIMEText(text, 'plain', _charset="UTF-8")
    part2 = MIMEText(html, 'html', _charset="UTF-8")

however then even if the payload isn't unicode it gets encoded which isn't ideal.

Is there a way to detect if text contains non ascii characters and only encode if it does?

gene1wood commented 3 years ago

Fixed in #36