Maybe we can store the uploaded file on disk as: lots-of-junk__encoded-filename.abc where: lots-of-junk is a unique hash string as web2py currently does. encoded-filename.abc can be the original filename encoded by base64 to make it appears as ascii-char only on disk.
Then when downloading, web2py provides a helper function to change the above "lots-of-junk__encoded-filename.abc" back into original "filename.abc", so that the download action can set it into the Content-Disposition header. The point here, is assuming the uploaded filename.abc is in utf8 encoding (the de-facto nowaday standard) or in locale encoding, even when in non-English scenario, and also assuming this encoding can be properly handled by browser. On Apr29, 7:26am, mdipierro <mdipie...@cs.depaul.edu> wrote: > I found this which answers some of my questions > > http://stackoverflow.com/questions/93551/how-to-encode-the-filename-p... > > On 28 Apr, 14:30, Yarko Tymciurak <yark...@gmail.com> wrote: > > > or maybe just hexing non-ascii standard characters (leave _something_ > > readable in _some_ cases).... > > would this work on latin character sets? > > > I mean would 'a' anywhere be encoded as '0x61'? > > > If so, that might be a human-useful thing. > > > 2009/4/28 mdipierro <mdipie...@cs.depaul.edu> > > > > Let's say I upload a file called 漢.dat from a windows machine, how do > > > I download it from a Unix machine? I just do not know different > > > browsers and > > > OSs will handle it and it may cause vulnerabilities. Anyway, I like > > > the idea of hexing and it probably better than the current solution. I > > > will try it later. > > > > Massimo > > > > On Apr 28, 2:14 pm, Yarko Tymciurak <yark...@gmail.com> wrote: > > > > > This solves the problem of storing it but not the problem of > > > > > downloading a file with a fancy name. We would lose the ability to > > > > > search the uploaded files by filename. > > > > > Not if you ALWAYS store by uploaded filename, and have the stored name > > > > as > > > a > > > > field for retrieval only... > > > > > Maybe I don't see the problem here... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---