mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
Fix #1934 : Unicode error in AddTorrent Dialog
This commit is contained in:
parent
0941377fac
commit
370035ffc5
1 changed files with 10 additions and 1 deletions
|
@ -196,7 +196,16 @@ class AddTorrentDialog(component.Component):
|
||||||
|
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
# Convert the path to unicode
|
# Convert the path to unicode
|
||||||
filename = unicode(filename)
|
log.debug("Adding torrent from file: %s (%s)", filename, type(filename))
|
||||||
|
try:
|
||||||
|
filename = unicode(filename, "utf8")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
# Try 'latin-1' if filename has originated from http
|
||||||
|
log.debug("Decode with 'utf-8' failed trying 'latin-1'")
|
||||||
|
filename = unicode(filename, "latin-1")
|
||||||
|
except TypeError:
|
||||||
|
# Already unicode
|
||||||
|
pass
|
||||||
|
|
||||||
# Get the torrent data from the torrent file
|
# Get the torrent data from the torrent file
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue