Module: deluge
Branch: 1.3-stable
Commit: 93091fbe23bf5a33abfdd45e156ee58ea71bde76

Author: Calum Lind <[email protected]>
Date:   Wed Feb  2 01:25:17 2011 +0000

Fix #1373, #1386 - Creating and moving non-ascii folder names in MS Windows

---

 deluge/common.py       |    2 +-
 deluge/core/torrent.py |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/deluge/common.py b/deluge/common.py
index 3acccd7..50a9417 100644
--- a/deluge/common.py
+++ b/deluge/common.py
@@ -591,7 +591,7 @@ def utf8_encoded(s):
 
     """
     if isinstance(s, str):
-        s = decode_string(s, locale.getpreferredencoding())
+        s = decode_string(s)
     elif isinstance(s, unicode):
         s = s.encode("utf8", "ignore")
     return s
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 3702c1f..38ff6d6 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -793,16 +793,20 @@ class Torrent(object):
 
     def move_storage(self, dest):
         """Move a torrent's storage location"""
-        if not os.path.exists(dest):
+        
+        # Convert path from utf8 to unicode
+        dest_u=unicode(dest,"utf-8")
+        
+        if not os.path.exists(dest_u):
             try:
                 # Try to make the destination path if it doesn't exist
-                os.makedirs(dest)
+                os.makedirs(dest_u)
             except IOError, e:
                 log.exception(e)
-                log.error("Could not move storage for torrent %s since %s does 
not exist and could not create the directory.", self.torrent_id, dest)
+                log.error("Could not move storage for torrent %s since %s does 
not exist and could not create the directory.", self.torrent_id, dest_u)
                 return False
         try:
-            self.handle.move_storage(dest.encode("utf8"))
+            self.handle.move_storage(dest_u)
         except:
             return False
 

-- 
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