Author: andar

Revision: 6168

Log:
        Use the preferred locale encoding when renaming files on add

Diff:
Modified: trunk/deluge/core/torrentmanager.py
===================================================================
--- trunk/deluge/core/torrentmanager.py 2010-01-29 16:40:49 UTC (rev 6167)
+++ trunk/deluge/core/torrentmanager.py 2010-02-03 02:41:24 UTC (rev 6168)
@@ -41,6 +41,7 @@
 import time
 import shutil
 import operator
+import locale
 
 from twisted.internet import reactor
 from twisted.internet.task import LoopingCall
@@ -387,7 +388,8 @@
             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"] = ""


-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to