summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2012-09-27 18:36:50 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2012-09-27 18:36:50 +0100
commit43390b850a19cfc9feb0c4bd825137d8f6a285e5 (patch)
treea6d01e8cb1d2906558540120a99e8fa6a9290a61
parent8c2189f1613b27e0e082bc8e0001e1fe5405be2c (diff)
downloaddeluge-43390b850a1.zip
deluge-43390b850a1.tar.gz
deluge-43390b850a1.tar.bz2
Fix 2163 : Cannot add torrent file with empty (0:) encoding tag
-rw-r--r--deluge/ui/common.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/deluge/ui/common.py b/deluge/ui/common.py
index 5f53db8..08504be 100644
--- a/deluge/ui/common.py
+++ b/deluge/ui/common.py
@@ -75,11 +75,13 @@ class TorrentInfo(object):
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.