From a308d12f0e0673155087946ea93b52958845573c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 6 Aug 2012 14:51:41 +0530 Subject: [PATCH] fixed export_query method: only encode strings of type unicode --- py/webnotes/widgets/doclistview.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/webnotes/widgets/doclistview.py b/py/webnotes/widgets/doclistview.py index bb06ac5fd6..50bcdf3ef1 100644 --- a/py/webnotes/widgets/doclistview.py +++ b/py/webnotes/widgets/doclistview.py @@ -240,7 +240,8 @@ def export_query(): writer = csv.writer(f) from webnotes.utils import cstr for r in data: - writer.writerow([v.encode('utf-8') for v in r]) + # encode only unicode type strings and not int, floats etc. + writer.writerow(map(lambda v: isinstance(v, unicode) and v.encode('utf-8') or v, r)) f.seek(0) webnotes.response['result'] = unicode(f.read(), 'utf-8')