如果XMLHttpRequest对象请求的文档未指定正确的utf-8编码,就会出现这个错误
浏览器系统错误:-1072896658(Explorer system error: -1072896658)
PHP:
1.
header(‘text/javascript; charset=utf-8’);
http://www.panoramio.com/blog/explorer-system-error-1072896658/
Don’t you love when explorer express its griefs in such a clear and helpful way?
A 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.
This entry was posted on Sunday, October 30th, 2005 at 10:59 pm and is
filed under Uncategorized. You can follow any responses to this entry
through the RSS 2.0 feed. You can leave a response, or trackback from
your own site.
6 Responses to "Explorer system error: -1072896658"
1. Johan Sundström Says:
November 2nd, 2005 at 11:10 am
Shouldn’t that rather be Content-Type: text/plain; charset=UTF-8
(or perhaps text/javascript, depending on the content payload)?
2. Joaquín Cuenca Abela Says:
November 2nd, 2005 at 11:32 am
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,