Merge pull request #29 from lca2017/chrisjrn/27-better-csv

Handles unicode strings properly.
This commit is contained in:
Scott Bragg 2016-07-04 22:22:10 +10:00 committed by GitHub
commit c5e9152b4c

View file

@ -140,6 +140,11 @@ def review_all_proposals_csv(request):
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)
return HttpResponse(output.getvalue(), "text/csv")