Use the preferred locale encoding when renaming files on add
This commit is contained in:
parent
f9d2e96d39
commit
9b23ce9e06
|
@ -41,6 +41,7 @@ import os
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
import operator
|
import operator
|
||||||
|
import locale
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet.task import LoopingCall
|
from twisted.internet.task import LoopingCall
|
||||||
|
@ -387,7 +388,8 @@ class TorrentManager(component.Component):
|
||||||
if options["mapped_files"]:
|
if options["mapped_files"]:
|
||||||
for index, name in options["mapped_files"].items():
|
for index, name in options["mapped_files"].items():
|
||||||
log.debug("renaming file index %s to %s", index, name)
|
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["ti"] = torrent_info
|
||||||
add_torrent_params["resume_data"] = ""
|
add_torrent_params["resume_data"] = ""
|
||||||
|
|
Loading…
Reference in New Issue