django实现中文文件名下载

研究中文文件名下载的结果:

1、加载

 from django.utils.http import urlquote

 from django.http import HttpResponse

 

 2、内容实现

 response = HttpResponse(mimetype='application/octet-stream')
 filename = u'演示.txt'
 response['Content-Disposition'] = 'attachment; filename="' + urlquote(filename) +'"'
 response.write(msg)
 return response

你可能感兴趣的:(django,import)