Handles unicode strings properly.

This commit is contained in:
Christopher Neugebauer 2016-07-04 22:18:34 +10:00
parent 6ebd0f0905
commit f126330390

View file

@ -140,6 +140,11 @@ def review_all_proposals_csv(request):
csv_line = [getattr(proposal, field) for field in fields] csv_line = [getattr(proposal, field) for field in fields]
# Enusre that unicode items are handled properly.
for i, item in enumerate(csv_line):
if isinstance(item, unicode):
csv_line[i] = item.encode("utf8")
writer.writerow(csv_line) writer.writerow(csv_line)
return HttpResponse(output.getvalue(), "text/csv") return HttpResponse(output.getvalue(), "text/csv")