From 9b23ce9e061d9070236c099ecf8ab29ea61717cb Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 3 Feb 2010 02:41:24 +0000 Subject: [PATCH] Use the preferred locale encoding when renaming files on add --- deluge/core/torrentmanager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index cb6f05591..baf7047fc 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -41,6 +41,7 @@ import os import time import shutil import operator +import locale from twisted.internet import reactor from twisted.internet.task import LoopingCall @@ -387,7 +388,8 @@ class TorrentManager(component.Component): if options["mapped_files"]: for index, name in options["mapped_files"].items(): log.debug("renaming file index %s to %s", index, name) - torrent_info.rename_file(index, name.encode("utf-8")) + torrent_info.rename_file(index, + name.encode("utf-8").decode(locale.getpreferredencoding(), "ignore")) add_torrent_params["ti"] = torrent_info add_torrent_params["resume_data"] = ""