# HG changeset patch # User Pawel Solyga # Date 1237137735 0 # Node ID 25116444358c2a3a039d758ea455eea3f3eddb9f # Parent 93dfd2d40c0bbb6f5c894c673df57b30e15948ca Fix missing utf encoding of data when exporting lists to csv file. Patch by: Pawel Solyga Reviewed by: to-be-reviewed diff -r 93dfd2d40c0b -r 25116444358c app/soc/views/models/base.py --- a/app/soc/views/models/base.py Sun Mar 15 16:42:54 2009 +0000 +++ b/app/soc/views/models/base.py Sun Mar 15 17:22:15 2009 +0000 @@ -746,10 +746,16 @@ if key_order: writer = csv.DictWriter(f, key_order, dialect='excel') writer.writerow(dicts.identity(key_order)) + + for row_dict in data: + for key in row_dict.keys(): + row_dict[key] = row_dict[key].encode("utf-8") + writer.writerow(row_dict) else: writer = csv.writer(f, dialect='excel') - - writer.writerows(data) + + for row in data: + writer.writerow(row.encode("utf-8")) data = f.getvalue()