Nintendo Wii forums Forum for writers phpBB mods Essays on copyright Dating advice Narnia forums

IE6 (Internet Explorer 6) eats form data

While working on some internal Web forms for Cadence, I came across a bonafide browser bug that I had never seen before.  Some people were filling out a form, but the form sometimes wouldn't work -- data was lost, and we couldn't figure out why.  Eventually I had eliminated bugs in my PHP code and as a last resort, I put a sniffer on the wire to watch the traffic.  What I found was amazing to me.  Internet Explorer 6 will fail to encode data properly (wiping out the first field) under very particular circumstances.  What's interesting is that, searching across the Internet, I found lots of people having the bug but not a lot of solutions.  That's odd, right?  I mean, IE 6 is a really old browser.  All the problems with it should have workarounds now, just as the box model issues in IE 6 do.  But this doesn't.  So I'll go over what I found, and how I fixed it.

The problem

Create a simple form in HTML -- don't specify DOCTYPE (or limit it to HTML 4), don't specify character set, etc.  Just the minimum needed to create the form in semantically correct markup.  However, you absolutely must add enctype="multipart/form-data" as an attribute in the form tag.  That's usually used to create forms that take uploads, such as the form to take photos on Facebook.  However, we don't need to create any upload fields.  We just need to create 2 text fields.  Throw some code in there somewhere to log the data that comes in.  Next, fire up Internet Explorer 6 and view your creation.  In the first field enter the word, "Hello."  In the second field enter the word "they’re."  What's important about the second word is that it has a curly apostrophe.  Copy & paste my text if you need to.  Then, submit the data.

Poof!  The word "Hello" never made it!  No matter what you put in that first field, it's lost.

The discovery

So the data isn't coming in.  Where is it?  Well, I fired up SmartSniff.  It's a packet sniffer, which can watch the raw data that Internet Explorer is sending to my server.  I'm watching because I want to see how the data is coming in -- is it funny somehow?  In an unexpected format?  It turns out, it's just broken.  Each field in a "multipart/form-data" form is sent wrapped in a boundary, which is typically a bunch of dashes and a random string of letters/numbers.  This is done so that each field is cleanly separated and the server can then view each field and correctly handle it.  But as you can see from my screenshot below, the first field doesn't have the boundary that the other fields do:

screenshot of packet sniffer capturing the bad data

The solution

The bug appears to rear its ugly head when UTF-8 data (or actually any data beyond ASCII), is sent as part of a multibyte form (a form that has upload fields).  This is what makes the bug so nefarious -- it will only appear on a form that has upload fields, and only if the page isn't specified to be UTF-8, and only when someone pastes in some UTF-8 text.  So one person might see the problem while another person with the same browser on the same system might not.

The fix?  Add this attribute to your form tag:


Now when non-ASCII data comes in, IE 6 will expect the multibyte characters and handle them properly.  Yay!



« Greasemonkey script for | Main | Lyrics to Into the Air, by 2Spaces »

Nav by tag: tech
« Greasemonkey script for | Main | Updated my Greasemonkey script for »
Bookmark It! Technorati Netvouz DZone ThisNext Wists blinkbits BlinkList blogmarks blogtercimlap Blue Dot Bumpzee co.mments connotea DotNetKicks Fark feedmelinks Fleck Furl Gwar Haohao Hemidemi IndiaGram IndianPad Internetmedia LinkaGoGo Linkter Ma.gnolia MyShare Netscape NewsVine PlugIM PopCurrent ppnow RawSugar Reddit Shadows Simpy Slashdot Smarking Spurl Webride YahooMyWeb

TrackBack URL for this entry:

Comments (17)

Hi there,
To remove a stored password or other stored information in Internet Explorer 6:
From the Tools menu, select Internet Options.
On the General tab, under Browsing history, click Delete... . You now have several options:
To delete temporary Internet files (copies of web pages, images, and media that are saved for faster viewing), click Delete files... .
To delete cookies, click Delete cookies... .
To delete the history (the lists of web sites you have visited), click Delete history... .
To delete form data (saved information that you have typed into forms), click Delete forms... .
To delete passwords, click Delete passwords... .
To delete all of the above, click Delete all... .
Click OK twice.

treadmill writes:


dress writes:

good article,thank you!

Thank you, this was worth the amount of work it took me to actually see it. You guys would never believe how many hoops I had to jump through to read your post. Don't ever emigrate to Bahrain, utterly arbitrary webpages have been blocked by the government and ISPs here for absolutely no reason. All the best: Zora Reppe

Bigcommerce App writes:

Nice article keep on sharing thanks :)

Abdulfatah writes:

Hi Westfall Family. My name is Meghan Marner, and I am 15 years old. I have an 18 year old reining Quarter Horse named Magic, and I love him to pecies. I've been with Magic for about a year and a half now. But every time I take him to a reining show, even if its a small potluck at our home arena, he loses his cool. He tenses and bolts through the entire pattern, utterly anxious and upset. When we are riding at home, (me, Magic, and sometimes my trainer Abby), he is a very talented reiner, and an all around happy horse. He showed in his younger years, and did very well. Do you think he is just done with showing? I love him so much, and don't want to move on to another horse, but I also don't want to put him through something that makes him upset. Do you have any suggestions, or any ideas about how to help my horse to be happy and calm at shows? Thank you for your time, and please answer back!p.s. I started reining after seeing your bridless ride with Roxy! Thank you for the inspiration!

I'm grateful you made the post. It's cleared the air for me.

This introduces a pleasingly rational point of view.

website writes:

I really couldn't ask for more from this article.

Your answer was just what I needed. It's made my day!

cars insurance writes:

We need more insights like this in this thread.

Thanks for starting the ball rolling with this insight.

Thanks guys, I just about lost it looking for this.

If you desire to grοw your familiarity just keep visitiոg this web page and be updated with the hottest iոformation posted heгe.

Son of a gun, this is so helpful!

A little rationality lifts the quality of the debate here. Thanks for contributing!

I would like to thank you for the efforts you have put in penning this site.

I am hoping to view the same high-grade blog posts by you in
the future as well. In fact, your creative writing
abilities has encouraged me to get my own, personal blog now ;)

Post a comment

Verification (needed to reduce spam):