List Info

Thread: Re: decode tool doesn't decode filename of uploaded files




Re: decode tool doesn't decode filename of uploaded files
country flaguser name
United States
2007-05-01 18:51:43
Nicolas Grilly wrote:
> Robert Brewer wrote:
> > AFAIK, declaring charset in the payload is already
defined for
> > multipart/form-data. http://www.ietf.o
rg/rfc/rfc2388.txt says:
> > ...
> > ...so implementing that should be straightforward.
However, I'd be
> > surprised if your user-agent is doing this. Is
it?
> 
> You're right: my user-agents don't respect the RFCs
(I've checked with
> Firefox 2.0 and Internet Explorer 7.0).
> 
> I've looked at the data sent by the user-agents. As
expected, the
> filename is given in the Content-Disposition header,
but is not
> encoded according to the RFCs. Here is a sample:
> 
> -----------------------------7d71f41c450754
> Content-Disposition: form-data;
name="your_file"; 
> filename="L'été est beau.pdf"
> Content-Type: application/pdf
> 
> I did some tests and observed the filename encoding
depends on the
> encoding declared in the HTML page. For example, if the
page is
> encoded in ISO-8859-1, the filename is encoded in
ISO-8859-1 too, and
> if the page is encoded in UTF-8, the filename is
encoded in UTF-8 too.

That's been my experience in the past.

> Can you confirm this behavior with your own
user-agents? If most
> user-agents behave like IE 7.0 and Firefox 2.0, we can
change the
> decode tool to decode the filename, using the encoding
explicitly
> specified by the developer when initializing the decode
tool.

Right. I'd add a separate decode_multipart_headers function
(with its own try/finally and fallback to ISO-8859-1) so
that a decoding error there doesn't stop correct decoding of
the params.


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )