- base, ext = attachment.filename().rsplit('.', 1)
- response['Content-Disposition'] = 'attachment; filename="%s.%s"' % (
- base.strip()[:20].replace('\n', '').strip(), ext)
+ # workaround to this: https://code.djangoproject.com/ticket/20889
+ response['Content-Disposition'] = 'attachment; filename="%s"' % unidecode(attachment.filename().replace('\n', ' '))