From: Gonzalo Odiard <godi...@sugarlabs.org> Browse can't download a file if the name is encoded in a codec different to UTF-8 --- downloadmanager.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/downloadmanager.py b/downloadmanager.py index c396317..90d22a5 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -306,9 +306,13 @@ class Download: elif self._source.scheme == 'data': return 'Data URI' else: - path = urlparse.urlparse(self._source.spec).path + uri = self._source + if uri == None: + return '' + cls = components.classes['@mozilla.org/intl/texttosuburi;1'] + texttosuburi = cls.getService(interfaces.nsITextToSubURI) + path = texttosuburi.unEscapeURIForUI(uri.originCharset, uri.spec) 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): -- 1.7.2.3 _______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel