Bugfix for python 3
Fix big from issue #52: https://github.com/martinrusev/imbox/issues/52
This commit is contained in:
@@ -10,7 +10,12 @@ if PY3:
|
||||
return str(value, encoding, errors)
|
||||
|
||||
def str_decode(value='', encoding=None, errors='strict'):
|
||||
return bytes(value, encoding, errors).decode('utf-8')
|
||||
if isinstance(value, str):
|
||||
return bytes(value, encoding, errors).decode('utf-8')
|
||||
elif isinstance(value, bytes):
|
||||
return value.decode('utf-8', errors=errors)
|
||||
else:
|
||||
raise TypeError( "Cannot decode '{}' object".format(value.__class__) )
|
||||
else:
|
||||
def str_encode(string='', encoding=None, errors='strict'):
|
||||
return unicode(string, encoding, errors)
|
||||
|
||||
Reference in New Issue
Block a user