#6009: UnicodeDecodeError when uploading file with non-english filename.
-----------------------+----------------------------------------------------
Reporter: bear330 | Owner: nobody
Status: new | Component: Internationalization
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
-----------------------+----------------------------------------------------
Comment (by lukestebbing):
I tried uploading '''中文.jpg''' using Safari and Firefox on the Mac:
{{{
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us) AppleWebKit/523.15.1
(KHTML, like Gecko) Version/3.0.4 Safari/523.15
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b3)
Gecko/2008020511 Firefox/3.0b3
}}}
Here's the associated content disposition header that showed up both times
in the raw post data:
{{{
Content-Disposition: form-data; name="file";
filename="中文.jpg"
}}}
This interacts with a three year old [http://bugs.python.org/issue1055234
bug] in `cgi.parse_header`, so Django sees the filename as '''中'''.
These two user agents seem to encode filenames in Latin-1, and if a
character doesn't fit in that charset, it's encoded as an HTML character
entity. Allowing all of Latin-1 looks like a violation of
[http://www.faqs.org/rfcs/rfc2388.html RFC 2388]/5.4 to me, but I suppose
it's due to a trend set by some old browser.
--
Ticket URL: <http://code.djangoproject.com/ticket/6009#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---