Bug 21424 - charset ignored in enctype attribute of form element
Summary: charset ignored in enctype attribute of form element
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2008-10-06 20:46 PDT by Andre-John Mas
Modified: 2010-08-30 13:12 PDT (History)
2 users (show)

See Also:

Test case (533 bytes, text/html)
2008-10-07 08:38 PDT, Andre-John Mas
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andre-John Mas 2008-10-06 20:46:39 PDT
If I specify the following:

<form action="" method="post" enctype="application/x-www-form-urlencoded; charset=utf-8" accept-charset="utf-8">

I find what is actually sent to the HTTP server is:

content-type: application/x-www-form-urlencoded

The charset is stripped from the content-type.

As a comparative test I checked with Opera which is sending the charset. Additionally if I read RFC2616 section 3.7.1, there is provision for allowing the character set to be specified.

I am not sure whether to see this issue as a bug that needs fixing, or an enhancement.
Comment 1 Darin Adler 2008-10-07 07:55:13 PDT
What do other browsers do?
Comment 2 Andre-John Mas 2008-10-07 08:38:35 PDT
Created attachment 24147 [details]
Test case

Having run the test case under Windows XP:

Firefox 3: Content-Type: application/x-www-form-urlencoded 
IE 7: Content-Type: application/x-www-form-urlencoded 
Opera 9.5: Content-Type: application/x-www-form-urlencoded; charset=utf-8
Safari 3: Content-Type: application/x-www-form-urlencoded

Maybe I am just misinterpreting the RFC. Can anyone tell me what should be done? Maybe someone with ties to the w3c?
Comment 3 Alexey Proskuryakov 2008-10-14 04:51:45 PDT
I doubt there's a better answer than "we should do what both IE and Firefox do". Also, I do not see anything in <http://www.w3.org/TR/html401/interact/forms.html> that would imply sending charset like this.

So, this just sounds like an Opera bug.
Comment 4 Aryeh Gregor 2010-08-30 11:44:10 PDT
FWIW, WebKit's behavior here is correct per HTML5:


Only the three literal strings "application/x-www-form-urlencoded", "multipart/form-data", and "text/plain" are allowed.  (Saw this while searching for another bug.)
Comment 5 Alexey Proskuryakov 2010-08-30 13:12:02 PDT
Resolving as INVALID per all the above.