#8857 HIGH Not Tri: Browse fails to download some files with non-ascii characters

Zarro Boogs per Child bugtracker at laptop.org
Tue Oct 21 04:43:35 EDT 2008


#8857: Browse fails to download some files with non-ascii characters
-------------------------------+--------------------------------------------
   Reporter:  tomeu            |       Owner:  erikos     
       Type:  defect           |      Status:  new        
   Priority:  high             |   Milestone:  Not Triaged
  Component:  browse-activity  |     Version:             
 Resolution:                   |    Keywords:             
Next_action:  never set        |    Verified:  0          
  Blockedby:                   |    Blocking:             
-------------------------------+--------------------------------------------

Comment(by tomeu):

 One possible solution, though I haven't been able to reproduce this bug:

 {{{
 diff --git a/downloadmanager.py b/downloadmanager.py
 index c6c0e1a..5e45f03 100644
 --- a/downloadmanager.py
 +++ b/downloadmanager.py
 @@ -20,6 +20,7 @@ from gettext import gettext as _
  import time
  import tempfile
  import urlparse
 +import urllib

  import gtk
  from xpcom.nsError import *
 @@ -87,6 +88,7 @@ class HelperAppLauncherDialog:
          dest_file = file_class.createInstance(interfaces.nsILocalFile)

          if default_file:
 +            default_file = default_file.encode('utf-8', 'replace')
              base_name, extension = os.path.splitext(default_file)
          else:
              base_name = ''
 @@ -247,6 +249,7 @@ class Download:
          else:
              path = urlparse.urlparse(self._source.spec).path
              location, file_name = os.path.split(path)
 +            file_name = urllib.unquote(file_name.encode('utf-8',
 'replace'))
              return file_name

      def _create_journal_object(self):
 }}}

-- 
Ticket URL: <http://dev.laptop.org/ticket/8857#comment:1>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list