Form data encoding Browsers roundup
Posted by admin on January 13 2010 11:53:53

In an HTML form element, the enctype attribute specifies how the data will be encoded when it is POSTed to the web server. Traditionally, there are two accepted content types for HTML forms:

But there is nothing to stop someone from specifying whatever enctype value that they want (e.g., "application/x-foo"). Of course specifying your own random value doesn't mean that the browser will understand how to submit it or the web server will understand how to process it.

The following lists how some popular browsers respond to unexpected but technically valid enctype values. Each of the MIME types from this list was tested. The following browsers were tested:

Go straight to the conclusions. Or, try some samples yourself.

Safari - Mac OS X

Version Tested: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419.3 (KHTML, like Gecko) Safari/419.3

Safari submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data contains the word multipartmultipart/form-datamultipart/example contains the word form-datamultipart/form-dataexample/form-data contains the word texttext/plain (content-type specifies nonexistent MIME boundary and posted data is urlencoded)text/example contains the word plaintext/plain (content-type specifies nonexistent MIME boundary and posted data is urlencoded)example/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Safari - Windows

Version Tested: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.15.5 (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5

Safari submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data contains the word multipartmultipart/form-datamultipart/example contains the word form-datamultipart/form-dataexample/form-data contains the word texttext/plain (content-type specifies empty MIME boundary and posted data is urlencoded)text/example contains the word plaintext/plain (content-type specifies empty MIME boundary and posted data is urlencoded)example/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Konqueror - Linux

Version Tested: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.7 (like Gecko)

Konqueror submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data contains the word multipartmultipart/form-datamultipart/example contains the word form-datamultipart/form-dataexample/form-data contains the word texttext/plain (content-type specifies nonexistent MIME boundary and posted data is urlencoded)text/example contains the word plaintext/plain (content-type specifies nonexistent MIME boundary and posted data is urlencoded)example/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Mozilla Firefox - Mac OS X

Version Tested: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Opera submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Mozilla Firefox - Windows

Version Tested: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Opera submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Mozilla Firefox - Linux

Version Tested: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Opera submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Opera - Mac OS X

Version Tested: Opera/9.23 (Macintosh; PPC Mac OS X; U; en)

Opera submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Opera - Windows

Version Tested: Opera/9.23 (Windows NT 5.1; U; en)

Opera submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Opera - Linux

Version Tested: Opera/9.23 (X11; Linux i686; U; en)

Opera submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Internet Explorer 7 - Windows

Version Tested: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322)

IE submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Internet Explorer 6 - Windows

Version Tested: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

IE submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data text/plaintext/plaintext/plain anything elseapplication/x-www-form-urlencodedexample/example
top

Internet Explorer 5 - Mac OS X

Version Tested:

IE submits the following content types:

The following rules are applied based on the value of enctype:

Specified enctypeSubmitted Content-TypeSample (omitted)application/x-www-form-urlencoded(omitted) application/x-www-form-urlencodedapplication/x-www-form-urlencodedapplication/x-www-form-urlencoded multipart/form-datamultipart/form-datamultipart/form-data anything elseapplication/x-www-form-urlencodedexample/example