#17536: Filename encoding broken for attachments in EmailMessage class -------------------------------------+------------------------------------- Reporter: alexey | Owner: nobody Type: Bug | Status: new Component: Core (Mail) | Version: SVN Severity: Normal | Resolution: Keywords: EmailMessage, | Triage Stage: broken encoding, unicode, i18n | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by alexey):
* needs_better_patch: => 0 * needs_tests: => 0 * needs_docs: => 0 Comment: It seems that bug is in _create_attachment method. I solved this by monkey-patching: {{{ def _create_attachment(self, filename, content, mimetype=None): """ Converts the filename, content, mimetype triple into a MIME attachment object. """ if mimetype is None: mimetype, _ = mimetypes.guess_type(filename) if mimetype is None: mimetype = DEFAULT_ATTACHMENT_MIME_TYPE attachment = self._create_mime_attachment(content, mimetype) if filename: attachment.add_header('Content-Disposition', 'attachment', filename=('utf-8','',filename)) # Changed here!!! return attachment }}} -- Ticket URL: <https://code.djangoproject.com/ticket/17536#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.