Module: deluge
Branch: master
Commit: acba442ddb13d3d6e8bde3c257b0bebd39fc1896

Author: Damien Churchill <[email protected]>
Date:   Mon May  3 18:43:31 2010 +0100

fix encoding issues where the users filesystem isn't utf-8 (needs testing)

---

 deluge/ui/gtkui/createtorrentdialog.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/deluge/ui/gtkui/createtorrentdialog.py 
b/deluge/ui/gtkui/createtorrentdialog.py
index 0cd3a53..f9b5a8a 100644
--- a/deluge/ui/gtkui/createtorrentdialog.py
+++ b/deluge/ui/gtkui/createtorrentdialog.py
@@ -35,6 +35,7 @@
 
 
 import gtk
+import sys
 import pkg_resources
 import os.path
 import gobject
@@ -158,8 +159,10 @@ class CreateTorrentDialog:
             chooser.destroy()
             return
 
+        path = result.decode('utf-8').encode(sys.getfilesystemencoding())
+
         self.files_treestore.clear()
-        self.files_treestore.append(None, [result, gtk.STOCK_FILE, 
deluge.common.get_path_size(result)])
+        self.files_treestore.append(None, [result, gtk.STOCK_FILE, 
deluge.common.get_path_size(path)])
         self.adjust_piece_size()
         chooser.destroy()
 
@@ -184,9 +187,10 @@ class CreateTorrentDialog:
             chooser.destroy()
             return
 
-        self.files_treestore.clear()
+        path = result.decode('utf-8').encode(sys.getfilesystemencoding())
 
-        self.files_treestore.append(None, [result, gtk.STOCK_OPEN, 
deluge.common.get_path_size(result)])
+        self.files_treestore.clear()
+        self.files_treestore.append(None, [result, gtk.STOCK_OPEN, 
deluge.common.get_path_size(path)])
         self.adjust_piece_size()
         chooser.destroy()
 
@@ -328,7 +332,7 @@ class CreateTorrentDialog:
                 self.glade.get_widget("progress_dialog").hide_all()
 
             deferToThread(self.create_torrent,
-                    path,
+                    path.decode('utf-8').encode(sys.getfilesystemencoding()),
                     tracker,
                     piece_length,
                     self._on_create_torrent_progress,

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