Opened 4 years ago

Closed 3 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 4 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 claudep 3 years ago.
Handle non ASCII filenames v2 + test

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by antonyc

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

comment:1 Changed 4 years ago by russellm

  • Component changed from Core framework to django.core.mail
  • Has patch set
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by anonymous

  • Severity set to Normal
  • Type set to New feature

comment:3 Changed 3 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 3 years ago by claudep

Handle non ASCII filenames v2 + test

comment:4 Changed 3 years ago by claudep

  • Needs tests unset
  • Patch needs improvement unset
  • Type changed from New feature to Bug

comment:5 Changed 3 years ago by ramiro

  • Triage Stage changed from Accepted to Ready for checkin

#17536 was a duplicate.

comment:6 Changed 3 years ago by ramiro

  • Resolution set to fixed
  • Status changed from new to closed

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