Comment 18 for bug 183366

Revision history for this message
In , Samuel Ryden (trahojen) wrote : Suggested patch

Package: bittornado-gui

Upon opening a .torrent file that contain file names with funky
characters in it, causing a UnicodeDecodeError exception.
Error message and suggested patch below.

BitTorrent T-0.3.17 (BitTornado)
OS: linux2
Python version: 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)]
wxWindows version: 2.6.3.2

Traceback (most recent call last):
  File "/usr/bin/btdownloadgui", line 2323, in _next
    savedas = dow.saveAs(choosefile, d.newpath)
  File "/var/lib/python-support/python2.5/BitTornado/download_bt1.py",
line 439, in saveAs
    n = path.join(n, i)
  File "posixpath.py", line 65, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 58:
ordinal not in range(128)

Suggested patch:
------
437a438,442
> import sys
> if sys.getdefaultencoding() == 'ascii':
> mustencode = True
> else:
> mustencode = False
438a444,445
> if mustencode:
> i = i.decode('ascii', 'replace')
------

Sorry for duplicate posts, I am still figuring this report system out.
I hope this is helpful to someone.

--
Best regards,

- Sam