X-Git-Url: https://git.phdru.name/?p=extfs.d.git;a=blobdiff_plain;f=torrent;fp=torrent;h=a0f827ef91f7ad213d7ab70445e9ef0e54e6175a;hp=bd5ff13f7db394d4b77329a278afed1f2bbd5ccb;hb=5e3deb43a2b9775a5d4e6b06df27dc8e6a8884c6;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