Another note to myself.
The python csv module has a bit of trouble writing unicode characters through – at least for me in our current setup. The workaround is to replace the code > 128
with ?
, thus:
response = HttpResponse(mimetype="text/csv")
response["Content-Disposition"] = "attachment; filename=choke.csv"
writer = csv.writer(response)
for line in list:
writer.writerow([line.something.encode("ascii", "replace"),]