Answer the question
In order to leave comments, you need to log in
How to pass the file name with Cyrillic to the response['Content-Disposition'] header?
In Django, I send a file via HttpResponse. I want to set the Cyrillic alphabet in the file name
response['Content-Disposition'] = 'attachment; filename="'+myfile+'”
Answer the question
In order to leave comments, you need to log in
RFC 8187 "Indicating Character Encoding and Language for HTTP Header Field Parameters"
from django.utils.encoding import escape_uri_path
response['Content-Disposition'] = "attachment; filename=*=UTF-8''"+ escape_uri_path(myfile)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question