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:
parent
32b7e1b130
commit
3ea934076f
1 changed files with 8 additions and 1 deletions
|
@ -129,5 +129,12 @@ class RegistrationsExportCsv(object):
|
||||||
|
|
||||||
def encode(self, text):
|
def encode(self, text):
|
||||||
if type(text) is unicode:
|
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
|
return text
|
||||||
|
|
Loading…
Add table
Reference in a new issue