Panoramio's Blog


Explorer system error: -1072896658

October 30th, 2005 by Joaquín Cuenca Abela

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.


18 Responses to “Explorer system error: -1072896658”  

  1. 1 Johan Sundström

    Shouldn’t that rather be Content-Type: text/plain; charset=UTF-8 (or perhaps text/javascript, depending on the content payload)?

  2. 2 Joaquín Cuenca Abela

    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,

  3. 3 Michael McCorry

    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*

  4. 4 intenter

    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?

  5. 5 Joaquín Cuenca Abela

    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,

  6. 6 Marcos B.L.

    Funny captcha … and great tip, thank you for saving me from my last two hours of frustation. :)

  7. 7 Raj Kanagaraj

    This article saved me tons of time. I was about to give up. Thanks a lot.

  8. 8 Joe

    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).

  9. 9 Philipp Jardas

    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.

  10. 10 Ot4eto

    The Exact command is:
    http_request.setRequestHeader(’Content-type’, ‘text/plain;charset=UTF-8;’);

    where http_request is instance of XMLHttpRequest object.

  11. 11 Eugene

    Thank you!
    This post saved my nerves :)
    It was just encoding, damn!

  12. 12 Kuroki Kaze

    THANK YOU MAN!!!!!! It was the encoding…. i had serious troubles with russian language pages (hehehheehe) :)

  13. 13 Pyronhell

    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!

  14. 14 loony

    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!

  15. 15 Tushar

    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.

  16. 16 Matias P.

    Joaquin,

    Thank you very much for the excelent post… It make my day.
    I am form Argentina, greetings.
    I have translated the solution to spanish

    Regards.

    Español/Spanish:

    Problema del IE6 (Internet Explorer 6) Error del sistema -1072896658,:

    Es muy probable que la página que esté llamando el JavaScript, tenga mal la codificación, en vez de “UTF8″ hay que usar “UTF-8″.

  17. 17 RycAm

    in case using php. The charset must also be set correctly: default_charset = “utf-8″
    And not default_charset = “utf8″.
    easy, but I missed it during 1 long day.

  18. 18 zunebest

    “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, http://www.zuneconverter.net it’s also accepted by XMLHttpRequest, but again, you should be extremelly careful with the name you give the encoding (respect uppercase characters, hyphens, …).”

Leave a Reply


For spam detection purposes, please copy the number 4516 to the field below: