e-hulp/HelpIM — Issue #125: exporing questionnaire results as csv fails when non-ascii characters are present
Author: winfried
Created: 2011-12-21 10:17:42+00:00
State: open
Labels: django, i18n

When you try to export the answers of a questionnaire, for example from: https://testchat1.e-hulp.nl/admin/forms/form/export/1/ and if there are non-ascii characters present in the questions or answers, you get an internal server error:

Traceback (most recent call last):

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py", line 93, in _wrapped_view
response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py", line 79, in _wrapped_view_func
response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py", line 197, in inner
return view(request, *args, **kwargs)

File "/usr/local/lib/python2.6/dist-packages/forms_builder/forms/admin.py", line 95, in export_view
csv.writerow(rows)

UnicodeEncodeError: 'ascii' codec can't encode character u'\xef' in position 2: ordinal not in range(128)