1 <!DOCTYPE HTML> 2 <meta 3 content 4 = 5 " 6 text/html; charset=ISO-8859-9 7 " 8 http-equiv 9 = 10 "Content-Type" 11 > 12 <p>Test: 13 <pre><!DOCTYPE HTML> 14 <meta 15 content 16 = 17 " 18 text/html; charset=ISO-8859-9 19 " 20 http-equiv 21 = 22 "Content-Type" 23 ></pre> 24 <p>Expected result: <span id="expected">Windows-1254</span> 25 <div> 26 <style scoped> 27 .pass { background: green; color: white; padding: 0.5em; font-weight: bold; } 28 .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; } 29 </style> 30 <p>Encoding used by browser is: <span id="encoding">Script did not run.</span> 31 <p>Result: <span id="result">Script did not run.</span> 32 <script> 33 var encoding = 'unknown'; 34 if ('' == '\u00E0') { // 0xE0 35 if ('' == '\u2122') { // 0x99 36 if ('' == '\u00FE') // 0xFE 37 encoding = 'Windows-1252'; 38 else if ('' == '\u015F') 39 encoding = 'Windows-1254'; 40 else if ('' == '\u200F') 41 encoding = 'Windows-1256'; 42 else if ('' == '\u20AB') 43 encoding = 'Windows-1258'; 44 else 45 encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122'; 46 } else if ('' == '\u02D9') // 0xFF 47 encoding = 'ISO-8859-3'; 48 else if ('' == '\u0177') // 0xFE 49 encoding = 'ISO-8859-14'; 50 else if ('' == '\u021B') 51 encoding = 'ISO-8859-16'; 52 else if ('' == '\u015F') 53 encoding = 'ISO-8859-9'; 54 else if ('' == '\u00BE') // 0xBE 55 encoding = 'ISO-8859-1'; 56 else if ('' == '\u0178') 57 encoding = 'ISO-8859-15'; 58 else 59 encoding = 'unknown with 0xE0 = U+00E0'; 60 } else if ('' == '\u0101') // 0xE0 61 encoding = 'ISO-8859-10'; 62 else if ('' == '\u0E40') // 0xE0 63 encoding = 'ISO-8859-11'; 64 else if ('' == '\uFFFD') { // 0xE0 65 if ('' == '\u263A') // 0xE2 0x98 0xBA 66 encoding = 'UTF-8'; 67 else 68 encoding = 'unknown (but ASCII-compatible)'; 69 } 70 document.getElementById('encoding').firstChild.data = encoding; 71 var expected = document.getElementById('expected').firstChild.data; 72 if (expected == '(demo - no expected result)') { 73 document.getElementById('result').firstChild.data = 'demo'; 74 } else if (encoding == expected) { 75 document.getElementById('result').firstChild.data = 'PASS'; 76 document.getElementById('result').className = 'pass'; 77 } else { 78 document.getElementById('result').firstChild.data = 'FAIL'; 79 document.getElementById('result').className = 'fail'; 80 } 81 if (parent.receivedResults) 82 parent.receivedResults(); 83 </script> 84 </div> 85