django版本2.0.2
python是Anaconda3.7
本人使用火狐浏览器,使用以下方法可以正常显示汉字
from django.utils.encoding import escape_uri_path
file_name = '我爱中国.txt'
response = StreamingHttpResponse(download_file(aim_file_path))
response['Content-Type'] = 'application/octet-stream'
response['Content-Disposition'] = "attachment;filename*=utf-8''{}".format(escape_uri_path(file_name))**
return response
如果要转载请注明出处链接!谢谢!
在Django 2.0.2环境下,使用Python Anaconda3.7版本,通过特定方法实现在火狐浏览器中正常显示中文文件名,具体涉及StreamingHttpResponse及文件名编码处理。
4744

被折叠的 条评论
为什么被折叠?



