]> git.phdru.name Git - extfs.d.git/blobdiff - torrent
Fixed a bug.
[extfs.d.git] / torrent
diff --git a/torrent b/torrent
index 712a653be9948ecf56d81c9797f70dbd7dc611c7..12310253730260f3217aafb8cd76a4bb2de7b534 100755 (executable)
--- a/torrent
+++ b/torrent
@@ -71,10 +71,11 @@ def mctorrent_list():
         torrent_error('Unknown name')
 
     name = info['name']
+    encoding = torrent.get('encoding', None)
+
     if 'files' in info:
         files = info['files']
         paths = []
-        encoding = torrent.get('encoding', None)
         for file in files:
             if 'path' not in file:
                 torrent_error('Unknown path')
@@ -89,6 +90,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 = []