make encoding configurable

This commit is contained in:
Helmut Merz 2015-03-17 10:08:20 +01:00
parent a565d750e3
commit f6f266acb5

View file

@ -22,6 +22,7 @@ View classes for export of report results.
import csv import csv
from cStringIO import StringIO from cStringIO import StringIO
from zope.cachedescriptors.property import Lazy
from zope.i18n import translate from zope.i18n import translate
from loops.common import normalizeName from loops.common import normalizeName
@ -36,7 +37,16 @@ class ResultsConceptCSVExport(ResultsConceptView):
reportMode = 'export' reportMode = 'export'
delimiter = ';' delimiter = ';'
encoding = 'UTF-8' #encoding = 'UTF-8'
#encoding = 'ISO8859-15'
#encoding = 'CP852'
@Lazy
def encoding(self):
enc = self.globalOptions('csv_encoding')
if enc:
return enc[0]
return 'UTF-8'
def getFileName(self): def getFileName(self):
return normalizeName(self.context.title) return normalizeName(self.context.title)