tolerate characters that raise encode errors

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3435 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-06-30 10:38:27 +00:00
parent 32b7e1b130
commit 3ea934076f

View file

@ -129,5 +129,12 @@ class RegistrationsExportCsv(object):
def encode(self, text):
if type(text) is unicode:
text = text.encode(self.encoding)
result = []
for c in text:
try:
c = c.encode(self.encoding)
except UnicodeEncodeError:
c = '?'
result.append(c)
text = ''.join(result)
return text