Fix #475 catch unicode decoding errors

This commit is contained in:
Andrew Resch
2008-11-16 08:29:31 +00:00
parent 87a8085ef7
commit 7dff5178e6
2 changed files with 91 additions and 82 deletions

View File

@@ -1,3 +1,7 @@
Deluge 1.0.6 (In Development)
Core:
* Fix #475 catch unicode decoding errors
Deluge 1.0.5 (09 November 2008)
GtkUI:
* Increase the per-torrent stop share ratio max to 99999.0

View File

@@ -318,8 +318,14 @@ class TorrentManager(component.Component):
else:
storage_mode = lt.storage_mode_t(1)
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"].encode("utf8")
add_torrent_params["save_path"] = options["download_location"]
add_torrent_params["storage_mode"] = storage_mode
add_torrent_params["paused"] = True
@@ -746,4 +752,3 @@ class TorrentManager(component.Component):
torrent_id = str(alert.handle.info_hash())
self.torrents[torrent_id].update_state()
component.get("SignalManager").emit("torrent_state_changed", torrent_id)