[Sugar-devel] [PATCH] OLPC #8857 - Browse fails to download some files with non-ascii characters

Simon Schampijer simon at schampijer.de
Tue Nov 23 08:45:36 EST 2010


On 11/19/2010 09:09 PM, Gonzalo Odiard wrote:
> I had a chat with silbe in irc, but we don't agreed in a solution.
> Right now the problem we have is, we are trying to use a file name with a
> name is not utf-8 encodeable. Dbus sent a error, and you can't download the
> file.
> The proposed solution take the encoding of the page to manipulate the file
> name.
> Is the same we (and mozilla) are using to display and manipulate the url
> from the page (browser.py line 300).
>
> More ideas?
>
> Gonzalo

Ok, I just had a look at your code. The charset we are passing to 
nsITextToSubURI [1], looks correct for the cases I tested (e.g. [2]), 
and does provide fallback mechanisms in the sense that it does not break 
when a wrong charset is used to encode. For example I passed 'UTF-8' 
when escaping the example and the url just did not look escaped right, 
but the download did finish fine etc.

I think this is fine, and we are using a standard way to handle the 
case. Definitely better than the current code where we just try to 
encode with UTF-8.

Regards,
    Simon

[1] http://xulplanet.mozdev.org/references/xpcomref/nsITextToSubURI.html
[2] http://www.cerlyn.com/q/


More information about the Sugar-devel mailing list