I had a chat with silbe in irc, but we don't agreed in a solution.<br>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.<br>
The proposed solution take the encoding of the page to manipulate the file name.<br>Is the same we (and mozilla) are using to display and manipulate the url from the page (browser.py line 300).<br><br>More ideas?<br><br>Gonzalo<br>
<br><br><silbe> gonzalo_: so it happens if you try to follow ("download") a link where the URL has characters in it that are not valid in UTF-8?<br><silbe> I.e. if you try to follow <a href="<a href="http://www.cerlyn.com/q/test2%f1%e2%e0.odt">http://www.cerlyn.com/q/test2%f1%e2%e0.odt</a>">foo</a> ?<br>
or is it the filename= MIME attribute that gets sent by the web server?<br><gonzalo_> silbe: yes, if you go to <a href="http://www.cerlyn.com/q/">http://www.cerlyn.com/q/</a> and try to download the last file<br><Cerlyn> from a user's perspective you get the file downloaded but sugar doesn't show any filename in the download dialogs or as part of the journal name ("File{two spaces}from ...")<br>
<-- acaleechurn ha cerrado (Quit: Ex-Chat)<br><gonzalo_> silbe, cerlyn: but internally there are errors, because dbus does not accept the utf string in the name<br> cerlyn: see you the file saved in the journal?<br>
<Cerlyn> gonzalo_: At least in os353 it gets saved<br><Cerlyn> it just lacks a name<br><gonzalo_> cerlyn: ok<br><Cerlyn> useful name anyway<br> the journal entry is labeled with the text that should surround the downloaded file's original name<br>
or maybe only in some cases. Clicking on it just shows 'Download completed" with no further info, and Show journal doesn't work , because there is no journal entry<br><silbe> gonzalo_: what does interfaces.nsITextToSubURI do if the URL is in a different encoding than the web page (which I guess is where the value of uri.originCharset comes from)?<br>
<Cerlyn> Right clicking and choosing download attempts to download an "Untitled" thing to the journal which doesn't complete. Maybe had more luck yesterday for some odd reason<br>--> timClicks (~<a href="mailto:tim@219-89-80-120.adsl.xtra.co.nz">tim@219-89-80-120.adsl.xtra.co.nz</a>) ha entrado en #sugar<br>
<gonzalo_> silbe: i don't know<br> cerlyn: i could not download the file without the patch<br><silbe> gonzalo_: My fear is that it would break in the same way. And I don't know of any requirement that URLs have to use the same encoding as the medium they're used in (in this case HTML).<br>
<gonzalo_> silbe: but i think the link the browse see is in the encoding from the page<br>--> m_anishh (qwebirc@gateway/shell/<a href="http://sugarlabs.org/x-srydaokmidwatxhk">sugarlabs.org/x-srydaokmidwatxhk</a>) ha entrado en #sugar<br>
<gonzalo_> silbe: think about that, the browse read a link with the encoding from the page<br><silbe> gonzalo_: exactly. but as URLs don't specify encodings, where does uri.originCharset get its value from?<br>
<silbe> oh, wait, I misread what you wrote.<br><gonzalo_> silbe: tjis case is different like if you put a arbitrary link in the location bar<br><silbe> gonzalo_: I don't think we can rely on HTML pages containing links _only_ to stuff in the same encoding as they use themselves.<br>
gonzalo_: e.g. if I take your link to the ODT file and put it on my web page (which uses UTF-8) it would still break. And I think that's a valid use case. :)<br><gonzalo_> silbe: but until we found a hypothetical case where can be browen, why not resolve what is broken now? <br>
<silbe> gonzalo_: because if we don't do it the right way now, we'll have to fix it _again_ later<br><Cerlyn> Well where do we get the name value anyway? The server can suggest a name in an HTTP header, and I'd have to look up what encoding it is there<br>
<silbe> Cerlyn: that was exactly my question. do we get it from the link (href=) or from something the server sent us?<br><gonzalo_> cerlyn, silbe: i dont know, is in the nsURI object <br><silbe> In the former case, we cannot assume anything about the encoding (though we might try some guesses, but those can go wrong). In the latter case we can probably (would need to cross-check with the standard) assume some specific encoding.<br>
<gonzalo_> cerlyn, silbe: what i am doing now in the download of the file is the same we are using in browser.py to get the url from the uri<br> cerlyn, silbe: just in the download we was arbitrary setting the encode like utf8<br>
silbe: can you see browser.py line 301<br><silbe> gonzalo_: sorry, I need to stop here. I'd like to finished the second version of the clean-up series today and need to go to bed soon. Can you summarise our discussion (or just cut&paste it) and post it to sugar-devel (as reply to the patch), please?<br>
<gonzalo_> silbe:ok<br><silbe> gonzalo_: thx<br><br><br><br>