X-Git-Url: https://git.phdru.name/?p=extfs.d.git;a=blobdiff_plain;f=torrent;h=7841fa7e672c950180e94414f2426a5e440891ba;hp=bd5ff13f7db394d4b77329a278afed1f2bbd5ccb;hb=refs%2Fheads%2Fmaster;hpb=305d8404d79009d42d8a421362beb1068bafd9bf diff --git a/torrent b/torrent index bd5ff13..a0f827e 100755 --- a/torrent +++ b/torrent @@ -318,7 +318,12 @@ def decode_torrent(): elif codepage: encoding = codepage.decode('ascii') else: - encoding = 'ascii' + 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) return torrent