From bbdcf7534ca242c8c99f4d941f8797cf339f98d3 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 27 May 2009 19:18:13 +0000 Subject: [PATCH] Make chardet a non-optional dependency in 1.2.x --- deluge/ui/common.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/deluge/ui/common.py b/deluge/ui/common.py index ae8f5300c..e8972af2a 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -37,6 +37,8 @@ import os import sys import urlparse +import chardet + try: from hashlib import sha1 as sha except ImportError: @@ -60,12 +62,7 @@ def decode_string(s, encoding="utf8"): try: s = s.decode(encoding).encode("utf8") except UnicodeDecodeError: - try: - import chardet - except ImportError: - s = s.decode(encoding, "replace").encode("utf8") - else: - s = s.decode(chardet.detect(s)["encoding"]).encode("utf8") + s = s.decode(chardet.detect(s)["encoding"]).encode("utf8") return s class TorrentInfo(object):