Opened 12 years ago

Closed 12 years ago

#2163 closed bug (Fixed)

.torrent encoding ("Unknown encoding")

Reported by: NicolaiS Owned by: Cas
Priority: trivial Milestone: 1.3.6
Component: Core Version: 1.3.5
Keywords: encoding Cc:

Description

If a torrent file have the "8:encoding" tag, but doesn't specify how the file is encoded ("0:"), then deluge gives an "Invalid File - Unknown encoding: " error.

Torrent files shouldn't be looking like this:

13:creation date
 i1292357935e

8:encoding
 '''0:'''

4:info
 ...

( they should be looking like this: )

13:creation date
 i1347442918e

8:encoding
 '''5:UTF-8'''

4:info
 ...

But lately I've seen a few with "8:encoding0:" I know how to manually fix this, but most end-users don't, so a default encoding of UTF-8 (in case of the encoding == "") would be preferred.

More info: Deluge doesn't give this error, if the "8:encoding" isn't there.

Tested on: Deluge 1.3.5 (libtorrent 0.15.10.0)

Attachments (2)

Pioneer.One.S01E01.REDUX.Xvid-VODO.torrent (28.6 KB) - added by NicolaiS 12 years ago.
Invalid torrent
Pioneer.One.S01E01.REDUX.Xvid-VODO.2.torrent (28.6 KB) - added by NicolaiS 12 years ago.
Valid torrent (same torrent, with encoding=UTF8)

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by NicolaiS

Invalid torrent

Changed 12 years ago by NicolaiS

Valid torrent (same torrent, with encoding=UTF8)

comment:1 Changed 12 years ago by NicolaiS

If a torrent file have the "8:encoding" tag, but doesn't specify how the file is encoded ("0:"), then deluge gives an "Invalid File - Unknown encoding: " error.

Torrent files shouldn't be looking like this:

13:creation date
 i1292357935e

8:encoding
 0:

4:info
 ...

( they should be looking like this: )

13:creation date
 i1347442918e

8:encoding
 5:UTF-8

4:info
 ...

But lately I've seen a few with "8:encoding0:" I know how to manually fix this, but most end-users don't, so a default encoding of UTF-8 (in case of the encoding == "") would be preferred.

More info: Deluge doesn't give this error, if the "8:encoding" isn't there.

Tested on: Deluge 1.3.5 (libtorrent 0.15.10.0)

comment:2 Changed 12 years ago by Cas

  • Milestone changed from Future to 1.3.6
  • Owner set to Cas
  • Status changed from new to assigned
  • Type changed from feature-request to bug
  • Version changed from other (please specify) to 1.3.5

Here is proposed fix for deluge/ui/common.py:

@@ -75,11 +75,13 @@
         self.__m_info_hash = sha(bencode.bencode(self.__m_metadata["info"])).hexdigest()
 
         # Get encoding from torrent file if available
-        self.encoding = "UTF-8" 
+        self.encoding = None
         if "encoding" in self.__m_metadata:
             self.encoding = self.__m_metadata["encoding"]
         elif "codepage" in self.__m_metadata:
             self.encoding = str(self.__m_metadata["codepage"])
+        if not self.encoding:
+            self.encoding = "UTF-8"
 
         # Check if 'name.utf-8' is in the torrent and if not try to decode the string
         # using the encoding found.

There was a similar issue in a forum post: http://forum.deluge-torrent.org/viewtopic.php?f=7&t=41147

comment:3 Changed 12 years ago by Cas

Fixed 1.3-stable: 43390b850a1

comment:4 Changed 12 years ago by Cas

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.