Issue on using frappe.sendmail to send email with attachment


When I use frappe.sendmail in my app, I noticed that the name of attachment shows incorrect if it is non-english like below.
The raw content of email shows like that.
Content-Disposition: attachment; filename=“中文附件-测试.zip”

I tested just use email client to send that attachment which shows correct filename,
the raw content is like that.
Content-disposition: attachment;

So my question is how to use sendmail to fix that issue.
Thank you.

I noticed the python code in frappe/frappe/ controls the filename of attachments.

   358          # Set the filename parameter
   359          if fname:
   360                  attachment_type = 'inline' if inline else 'attachment'
   361                  part.add_header('Content-Disposition', attachment_type, filename=text_type(fname))
   362          if content_id:
   363                  part.add_header('Content-ID', '<{0}>'.format(content_id))
   365          parent.attach(part)

i’m thinking if add utf-8 encode for fname, that may fix the issue.