Opened 6 years ago

Closed 5 years ago

#14964 closed Bug (fixed)

create_attachment support for unicode symbols in filename

Reported by: Anton Chaporgin Owned by: nobody
Component: Core (Mail) Version: master
Severity: Normal Keywords: email attachment, filenames, i18n
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When attaching a file containing non ASCII symbols, the standarts required adding special prefix to the filename. For example, when file name is in unicode, like u"Имя Файла.txt" ("filename.txt" in english), the headers in the letter should be

filename: "UTF-8%C3%90%C2%98%C3%90%C2%BC%C3%91%C2%8F%20%C3%90%C2%A4%C3%90%C2%B0%C3%90%C2%B9%C3%90%C2%BB%C3%90%C2%B0.txt"

So, I suggest adding special check for this case in "_create_attachment" method of EmailMessage class, see attached diff.

Attachments (2)

mail_attachment.diff (1.1 KB) - added by antonyc 6 years ago.
The diff between trunk as of 2010-12-24 21:19:48 handling non ASCII filenames in email attachments
14964-2.diff (1.8 KB) - added by Claude Paroz 5 years ago.
Handle non ASCII filenames v2 + test

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by antonyc

Attachment: mail_attachment.diff added

The diff between trunk as of 2010-12-24 21:19:48 handling non ASCII filenames in email attachments

comment:1 Changed 6 years ago by Russell Keith-Magee

Component: Core frameworkdjango.core.mail
Has patch: set
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by anonymous

Severity: Normal
Type: New feature

comment:3 Changed 5 years ago by anonymous

Easy pickings: unset
UI/UX: unset

The standard library Header class might be a better way to do this. It handles various RFCs.

Changed 5 years ago by Claude Paroz

Attachment: 14964-2.diff added

Handle non ASCII filenames v2 + test

comment:4 Changed 5 years ago by Claude Paroz

Needs tests: unset
Patch needs improvement: unset
Type: New featureBug

comment:5 Changed 5 years ago by Ramiro Morales

Triage Stage: AcceptedReady for checkin

#17536 was a duplicate.

comment:6 Changed 5 years ago by Ramiro Morales

Resolution: fixed
Status: newclosed

In [17375]:

Made email attachment handling code accept non-ASCII filenames.

Thanks to Anton Chaporgin for the report and to Claude Paroz for the patch.

Fixes #14964.

Note: See TracTickets for help on using tickets.
Back to Top