Commit 7a5e4097 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

if the input is not str but unicode, convert it to str, otherwise...

if the input is not str but unicode, convert it to str, otherwise UnicodeEncodeError can be raised by exporting Page Template containing non-ASCII characters.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28750 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5844fe5f
......@@ -45,7 +45,10 @@ def convert(S, find=None):
### [\x00-\x1f] characters will be escaped to make a more
### readable output.
try:
S.decode('utf8')
if isinstance(S, unicode):
S = S.encode('utf8')
else:
S.decode('utf8')
except UnicodeDecodeError:
new = ''.join([reprs3.get(x) for x in S])
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment