encoding = encoding.decode('ascii')
elif codepage:
encoding = codepage.decode('ascii')
-
- if PY3 and encoding:
+ else:
+ for encoding in ('ascii', 'utf-8', default_encoding):
+ try:
+ return decode_dict(torrent, encoding)
+ except UnicodeDecodeError:
+ pass
+ torrent_error('UnicodeDecodeError')
return decode_dict(torrent, encoding)
- else:
- return torrent
+
+ return torrent
def decode_datetime_asc(dt):