From 7813bd409881aa34f58d7d8dc43b3d8a335f7811 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 16 Nov 2008 08:29:31 +0000 Subject: [PATCH] Fix #475 catch unicode decoding errors --- deluge/core/torrentmanager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index fbb4bd4f1..dced0e02d 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -331,9 +331,14 @@ class TorrentManager(component.Component): else: storage_mode = lt.storage_mode_t(1) - # Fill in the rest of the add_torrent_params dictionary - add_torrent_params["save_path"] = options["download_location"].encode("utf8") + try: + # Try to encode this as utf8 if needed + options["download_location"] = options["download_location"].encode("utf8") + except UnicodeDecodeError: + pass + # Fill in the rest of the add_torrent_params dictionary + add_torrent_params["save_path"] = options["download_location"] add_torrent_params["storage_mode"] = storage_mode add_torrent_params["paused"] = True add_torrent_params["auto_managed"] = False