from urllib import quote
_file_name = quote("测试".encode("utf-8")) data = models.AdaptationPChannel.export_active_project(start_date) response = HttpResponse(data) response['Content-Type'] = 'application/octet-stream' response['Content-Disposition'] = u'attachment;filename="%s"' % _file_name
由于字符串默认编码方式为unicode需要转utf-8然后通过quote转urlencode。
"测试" 转码后 "%E6%B5%8B%E8%AF%95"