def downloadFile(request):
name = '你好.txt'
file = open("passages/文章.txt","rb")
response = FileResponse(file)
response['Content-Type'] = 'application/octet-stream'
#response['Content-Disposition'] = 'attachment;filename="{0}"'.format(name.encode('utf8').decode('ISO-8859-1')) 这种方式也可以
response['Content-Disposition'] = 'attachment;filename=%s' % name.encode('utf8').decode('ISO-8859-1')
return response
自动弹出选择文件保存在哪,且保存时出现的文件名为中文