django viewは中国語名ファイルを返します
664 ワード
def shujubiao(request):
contact_id=request.GET["id"]
c=Contact.objects.get(id=contact_id)
fullfilepath = os.path.join(MEDIA_ROOT,"t_ .xml")
logging.info(fullfilepath)
data=genShujubiao(c,fullfilepath)
t=HttpResponse(data,content_type="text/xml")#application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")#content_type="text/xml")#application/vnd.ms-excel")
tstr='attachment; filename=%s' % c.yonghu+"_"+c.yiqixinghao+"_ .xml"
t['Content-Disposition'] = tstr.encode("gb2312")
return t