Fix missing utf encoding of data when exporting lists to csv file.
Patch by: Pawel Solyga
Reviewed by: to-be-reviewed
--- 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()