Character encoding detection for external scripts

Notes

This is (EF BB BF) C3 B6 3D 22 21 22 loaded into browsers under various labels. That happens to be properly formed ECMAScript code for all the encodings used. The bogus results for Opera9 can easily be reproduced in context of the testing script, but probably not individually from a clean cache; what's going on there is unknown. I also noted in running these tests that Opera claims "Opera supports the entire ECMA-262 2nd and 3rd standards with no exceptions" while in fact their implementation does not, the parser rejects code that follows the IdentifierStart :: \ UnicodeEscapeSequence production of ECMA-262 section 7.6. Instead it implements Opera-only extensions, like comma-free arrays ala [ 1 2 3 ]. Other fun facts include: IE does not implement onload for iframes and cannot modify the innerHTML or tr elements; Firefox ignores "tags" when setting the innerHTML of dynamically created tr elements with no ownerElement... Oh and Opera again needs </th> "tags" so it won't nest adjacent th elements when setting innerHTML.

Results

HTML HTTP C-T JS HTTP C-T <script charset=... utf-8 bom IE6 Opera9 FF3 Safari4 "HTML5"
iso-8859-2 iso-8859-2 iso-8859-2 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-2 iso-8859-2 iso-8859-2 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-2 iso-8859-2 iso-8859-5 0 iso-8859-5 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-2 iso-8859-2 iso-8859-5 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-2 iso-8859-2 none 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-2 iso-8859-2 none 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-2 iso-8859-2 utf-8 0 utf-8 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-2 iso-8859-2 utf-8 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-2 iso-8859-5 iso-8859-2 0 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-2 iso-8859-5 iso-8859-2 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-2 iso-8859-5 iso-8859-5 0 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-2 iso-8859-5 iso-8859-5 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-2 iso-8859-5 none 0 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-2 iso-8859-5 none 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-2 iso-8859-5 utf-8 0 utf-8 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-2 iso-8859-5 utf-8 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-2 none iso-8859-2 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-2 none iso-8859-2 1 utf-8 utf-8 iso-8859-2 utf-8 utf-8
iso-8859-2 none iso-8859-5 0 iso-8859-5 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-2 none iso-8859-5 1 utf-8 utf-8 iso-8859-5 utf-8 utf-8
iso-8859-2 none none 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-2 none none 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-2 none utf-8 0 utf-8 iso-8859-2 utf-8 utf-8 utf-8
iso-8859-2 none utf-8 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 iso-8859-2 0 iso-8859-2 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 iso-8859-2 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 iso-8859-5 0 iso-8859-5 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 iso-8859-5 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 none 0 iso-8859-2 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 none 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 utf-8 0 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-2 utf-8 utf-8 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-5 iso-8859-2 iso-8859-2 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-5 iso-8859-2 iso-8859-2 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-5 iso-8859-2 iso-8859-5 0 iso-8859-5 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-5 iso-8859-2 iso-8859-5 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-5 iso-8859-2 none 0 iso-8859-5 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-5 iso-8859-2 none 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-5 iso-8859-2 utf-8 0 utf-8 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-5 iso-8859-2 utf-8 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
iso-8859-5 iso-8859-5 iso-8859-2 0 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-5 iso-8859-5 iso-8859-2 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-5 iso-8859-5 iso-8859-5 0 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-5 iso-8859-5 iso-8859-5 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-5 iso-8859-5 none 0 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-5 iso-8859-5 none 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-5 iso-8859-5 utf-8 0 utf-8 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-5 iso-8859-5 utf-8 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
iso-8859-5 none iso-8859-2 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
iso-8859-5 none iso-8859-2 1 utf-8 utf-8 iso-8859-2 utf-8 utf-8
iso-8859-5 none iso-8859-5 0 iso-8859-5 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-5 none iso-8859-5 1 utf-8 utf-8 iso-8859-5 utf-8 utf-8
iso-8859-5 none none 0 iso-8859-5 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5
iso-8859-5 none none 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-5 none utf-8 0 utf-8 iso-8859-2 utf-8 utf-8 utf-8
iso-8859-5 none utf-8 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 iso-8859-2 0 iso-8859-2 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 iso-8859-2 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 iso-8859-5 0 iso-8859-5 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 iso-8859-5 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 none 0 iso-8859-5 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 none 1 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 utf-8 0 utf-8 utf-8 utf-8 utf-8 utf-8
iso-8859-5 utf-8 utf-8 1 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 iso-8859-2 iso-8859-2 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
utf-8 iso-8859-2 iso-8859-2 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
utf-8 iso-8859-2 iso-8859-5 0 iso-8859-5 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
utf-8 iso-8859-2 iso-8859-5 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
utf-8 iso-8859-2 none 0 utf-8 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
utf-8 iso-8859-2 none 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
utf-8 iso-8859-2 utf-8 0 utf-8 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
utf-8 iso-8859-2 utf-8 1 utf-8 iso-8859-2 iso-8859-2 utf-8 utf-8
utf-8 iso-8859-5 iso-8859-2 0 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
utf-8 iso-8859-5 iso-8859-2 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
utf-8 iso-8859-5 iso-8859-5 0 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
utf-8 iso-8859-5 iso-8859-5 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
utf-8 iso-8859-5 none 0 utf-8 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
utf-8 iso-8859-5 none 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
utf-8 iso-8859-5 utf-8 0 utf-8 iso-8859-5 iso-8859-5 iso-8859-5 iso-8859-5
utf-8 iso-8859-5 utf-8 1 utf-8 iso-8859-5 iso-8859-5 utf-8 utf-8
utf-8 none iso-8859-2 0 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2 iso-8859-2
utf-8 none iso-8859-2 1 utf-8 utf-8 iso-8859-2 utf-8 utf-8
utf-8 none iso-8859-5 0 iso-8859-5 iso-8859-2 iso-8859-5 iso-8859-5 iso-8859-5
utf-8 none iso-8859-5 1 utf-8 utf-8 iso-8859-5 utf-8 utf-8
utf-8 none none 0 utf-8 iso-8859-2 utf-8 utf-8 utf-8
utf-8 none none 1 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 none utf-8 0 utf-8 iso-8859-2 utf-8 utf-8 utf-8
utf-8 none utf-8 1 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 iso-8859-2 0 iso-8859-2 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 iso-8859-2 1 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 iso-8859-5 0 iso-8859-5 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 iso-8859-5 1 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 none 0 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 none 1 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 utf-8 0 utf-8 utf-8 utf-8 utf-8 utf-8
utf-8 utf-8 utf-8 1 utf-8 utf-8 utf-8 utf-8 utf-8