Recode filename in a single-file torrent.
authorOleg Broytman <phd@phdru.name>
Thu, 11 Nov 2010 12:53:36 +0000 (12:53 +0000)
committerOleg Broytman <phd@phdru.name>
Thu, 11 Nov 2010 12:53:36 +0000 (12:53 +0000)
git-svn-id: file:///home/phd/archive/SVN/mc-extfs/trunk@45 1a6e6372-1aea-0310-bd00-dc960550e1df

torrent

diff --git a/torrent b/torrent
index 712a653..825293b 100755 (executable)
--- a/torrent
+++ b/torrent
@@ -89,6 +89,8 @@ def mctorrent_list():
         if 'length' not in info:
             torrent_error('Unknown length')
         length = info['length']
+        if charset and encoding and (charset != encoding):
+            name = name.decode(encoding, 'replace').encode(charset, 'replace')
         paths = [(name, length)]
 
     meta = []