Explorer system error: -1072896658
Don’t you love when explorer express its griefs in such a clear and helpful way?
I was putting the last touches to the new “Search place” code, and it was working beautifully in Firefox and in Explorer, when I faced a problem in Safari. The query to the database that retrieves the name of places that match the user search came back with the accents garbled!
Safari thought the received page, that I was retrieving with XMLHttpRequest behind the scenes, was encoded in ISO-8859-1 (or most probably, -15) when I was serving it in UTF-8.
Fair enough, I just have to put the header “Content-Type: text/plain; charset=utf8″ in the reply, and sure enough, Safari was now working like a charm.
But then, the search stopped working at all in Internet Explorer! I was getting a weird error in the status bar:
Explorer system error: -1072896658
This thing popped when I tried to access the responseText of the request object. After I googled a bit this error code, I found that it was due to the XMLHttpRequest control receiving a reply on an unknown encoding. Please guys, next time put a message like:
XMLHttpRequest requested document was in the unknown “utf8″ encoding. See the list of accepted encodings.
It turns out the charset should be UTF-8, and not utf8. Fixed it, and now it is happily working on these 3 browsers.
Update: Attentive reader Johan Sundström pointed out that I was missing the “text/plain; charset=” part on the Content-Type. I should really double check my blog entries before posting them.
15 Responses to “Explorer system error: -1072896658”
Leave a Reply
Archives
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
Categories
- css (2)
- html (8)
- Interaction Design (6)
- javascript (11)
- miscellaneous (25)
- new features / improvements (55)
- panoramio (39)
- personal (2)
- places (25)
- Uncategorized (5)
Shouldn’t that rather be Content-Type: text/plain; charset=UTF-8 (or perhaps text/javascript, depending on the content payload)?
Hi Johan,
yes, it should be Content-Type: text/plain; charset=UTF-8, thank you for the catch! I wrote this entry in a hurry and I missed it completely.
Regards,
Thank the moons for this post. After looking for about 30 mins, this is the first page I’ve found on this subject that explains in plain english exactly what is causing the problem, and how to fix it. In my case it only appears to occur on a Linux server (I’ve tried it on two other IIS servers and they worked fine - unfortunately, they’re not my production servers). Thanks Joaquín. I’ll try it out tonight. *fingers crossed*
Bless you for this post!
It was just encoding!
So, XMLHttpRequest accepts UTF-8… But the rest of the page in other encoding….Does browser convert data from UTF-8 into another encoding?
Hi,
Yes, indeed, the exception comes from mlang.dll, I guess that when it tries to do the conversion.
But I have not really tested it, as all my pages are in UTF-8, so I don’t really need any conversion. If you are using ISO latin 1, it’s also accepted by XMLHttpRequest, but again, you should be extremelly careful with the name you give the encoding (respect uppercase characters, hyphens, …). For iso latin 1, the charset must be ISO-8859-1
Cheers,
Funny captcha … and great tip, thank you for saving me from my last two hours of frustation.
This article saved me tons of time. I was about to give up. Thanks a lot.
Phew… unlike the former commenters, I have already spent two (!) days over TCP dumps of http requests from both Firefox and MSIE.
I was looking for some hint why on earth IE falied where Firfo just worked. And then I noticed the supid “error big negative number”, nicely tucked away in a try{} catch{} block.
Going to have someone change the apache conf - glad that finally there *is* an explanation - thanks a million!
Oh, and by the way, if you need dumps of your tcp traffic, tcpflow is a nice command line utility (compiles fine on Mac OSX).
Thanks for that concise description of the problem. I hope MSIE would be that verbose… =) For your general amusement: In our current setup we use an Oracle Application Server which does not only send different default encoding headers on different platforms, it even send ISO-8859-1 as “ISO-8859_1″ (note the underscore) which wrecked the pages when requested via AJAX, but not when requested directly. You have to manually set the content type in your servlet or JSP or whatever you are using.
The Exact command is:
http_request.setRequestHeader(’Content-type’, ‘text/plain;charset=UTF-8;’);
where http_request is instance of XMLHttpRequest object.
Thank you!
This post saved my nerves
It was just encoding, damn!
THANK YOU MAN!!!!!! It was the encoding…. i had serious troubles with russian language pages (hehehheehe)
You can set the content-type with php:
At line 1 of your requested file with XMLHttpRequest
(change text/html with text/plain if required).
See ya!
Add a file called .htaccess to your websites rootdirectory if you are using apache (or your isp uses apache) and it’s delivering the wrong charset (like utf8 instead of utf-8 as IE expects it) with the following content:
AddCharset utf-8 .php
(or any other extension that might be useful in your context.
See
http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/charset4.asp
and
http://www.w3.org/International/questions/qa-htaccess-charset
for more information on character encoding issues!
throughs an error System error 1072896658
I have declared the object as
var xmlhttp = new ActiveXObject(”Msxml2.XMLHTTP”);
it works for IE version 6.0.2600 but not for IE version 6.0.2800.
Pls help me
i coudnlt find out what this error means.