Subdownloader crashs with accents

Bug #913453 reported by costales
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
SubDownloader
Status tracked in Trunk
Trunk
Fix Committed
Undecided
Alessandro Losavio
subdownloader (Debian)
Fix Released
Unknown

Bug Description

Hi!
When the video path has a special characters (as spanish accent) Subdownloader crashs.
As example, my "Vídeos" folder:

marcos@laptop:~$ subdownloader
Traceback (most recent call last):
  File "/usr/share/subdownloader/gui/main.py", line 1044, in onButtonDownload
    destinationPath = self.getDownloadPath(sub.getVideo(), sub)
  File "/usr/share/subdownloader/gui/main.py", line 1013, in getDownloadPath
    downloadFullPath = os.path.join(folderPath, subFileName).decode('utf8')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 14: ordinal not in range(128)
marcos@laptop:~$

I inserted
print(folderPath, subFileName)
on line 1012 of /usr/share/subdownloader/gui/main.py file.
This is the path value for /home/marcos/Vídeos/Supernatural Season 3:
(u'/home/marcos/V\xeddeos/Move_folder', u'subtitle_movie.srt')

I think the .decode('utf8') not works, and I just try with 'utf-8' and same result.

If I rename the folder without accent, all works right.

Best regards and thanks.

Related branches

costales (costales)
description: updated
costales (costales)
description: updated
Revision history for this message
Alessandro Losavio (alo21) wrote :

Does this bug still exist? Could you give us more informations please?
To best way to do this is to run in a terminal:

apport-collect: 913453

Thanks!

Changed in subdownloader:
status: New → Incomplete
Revision history for this message
Kemel Zaidan aka Legendario (kemelzaidan) wrote :

It does exist.

Revision history for this message
Kemel Zaidan aka Legendario (kemelzaidan) wrote :

$ subdownloader

(python:6102): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed

(python:6102): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed

(python:6102): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed

(python:6102): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed
Traceback (most recent call last):
  File "/usr/share/subdownloader/gui/main.py", line 1043, in onButtonDownload
    destinationPath = self.getDownloadPath(sub.getVideo(), sub)
  File "/usr/share/subdownloader/gui/main.py", line 1012, in getDownloadPath
    downloadFullPath = os.path.join(folderPath, subFileName).decode('utf8')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 13: ordinal not in range(128)

Revision history for this message
Alessandro Losavio (alo21) wrote :

Could you tell us how to reproduce the bug, please? It is very important, to reproduce it and know if out fix works correctly.

Thanks

Changed in subdownloader:
milestone: none → 2.0.17-1
Revision history for this message
Emilien Klein (emilien-klein) wrote :

Steps to reproduce the bug:
- Create a folder that contains an accentuated character
- Place a video in that folder (or any subfolder therein)
- Open SubDownloader and try to download a subtitle for that video file

Example of a few accentuated character:
é í à è

In French, the Download folder is ~/Téléchargements/ and the Videos folder is ~/Vidéos/
A video in any of these default folders will make Subdownloader crash. This is due to SubDownloader not being able to properly handle non-ASCII characters in the path (either folder or video filename).

This bug is not new: bug #306589 (reported on 2008-12-09) supposedly fixed it (status fix committed) but this is still an issue. Not sure that the patch provided is either still present, or even working.

Also, this bug is the reason SubDownloader got removed from Debian. Allessandro, if you fix it I'll backport this fix to 2.0.14 (the version in Debian and in the current Ubuntu repositories) so that it can be included again in the official Debian archive. Hopefully we can do this in time before the new Debian is released...

Revision history for this message
Emilien Klein (emilien-klein) wrote :

Links to what I referred to in my previous post:

Debian Bug:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606993

[2011-01-08] subdownloader REMOVED from testing (Britney)
http://packages.qa.debian.org/s/subdownloader.html

Changed in subdownloader (Debian):
status: Unknown → Confirmed
Revision history for this message
Alessandro Losavio (alo21) wrote :

I tested SubDownloader 2.0.7 by myself on Debian, and all works fine. These days we will release SubDownloader 2.0.17-1 for Ubuntu 13.04 (alongside the source).

Changed in subdownloader:
status: Incomplete → In Progress
assignee: nobody → Alessandro Losavio (alo21)
Revision history for this message
Emilien Klein (emilien-klein) wrote : Re: [Bug 913453] Re: Subdownloader crashs with accents

Not sure I'm understanding this right: do you mean that this issues is fixed?
I've tested on Saturday with the 2.0.17 deb package available on
Launchpad, and the issue is still present.

Revision history for this message
Emilien Klein (emilien-klein) wrote :

When running from sources (revision ) with the following file ~/Téléchargements/jd/Breaking.Bad.S05E06._.XviD-AFG.avi I get the following Exception:

Traceback (most recent call last):
  File "/home/emilien/devel/subdownloader/gui/main.py", line 1060, in onButtonDownload
    destinationPath = self.getDownloadPath(sub.getVideo(), sub)
  File "/home/emilien/devel/subdownloader/gui/main.py", line 1029, in getDownloadPath
    downloadFullPath = os.path.join(folderPath, subFileName).decode(sys.getfilesystemencoding())
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 15: ordinal not in range(128)

The attached patch solves this issue. The end result is that it properly downloads the subtitle file and puts it next to the video file with the following name: ~/Téléchargements/jd/Breaking.Bad.S05E06._.XviD-AFG.srt

Hope you can apply it to the main branch when releasing the next version.
I will work to get this patch applied to the Debian package, so that it can hopefully reintegrate the testing branch and be included in the upcoming Debian release.

Changed in subdownloader (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.