squash! Python3: fix strformat ascii_safe() and unicode_safe()

This commit is contained in:
Chris Mayo 2019-04-29 20:35:07 +01:00 committed by anarcat
parent ac14585a78
commit 1c2e6c465e

View file

@ -64,7 +64,8 @@ def unicode_safe (s, encoding=i18n.default_encoding, errors='replace'):
return unicode(str(s), encoding, errors)
except NameError: # Python3
if isinstance(s, bytes):
return s.decode("utf-8", errors)
return s.decode(encoding, errors)
return str(s)
def ascii_safe (s):