| <!DOCTYPE HTML> |
| <meta http-equiv="Content-Type" charset=" |
| ISO-8859-9 "> |
| <p>Test: |
| <pre><!DOCTYPE HTML> |
| <meta http-equiv="Content-Type" charset=" |
| ISO-8859-9 "></pre> |
| <p>Expected result: <span id="expected">Windows-1254</span> |
| <div> |
| <style scoped> |
| .pass { background: green; color: white; padding: 0.5em; font-weight: bold; } |
| .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; } |
| </style> |
| <p>Encoding used by browser is: <span id="encoding">Script did not run.</span> |
| <p>Result: <span id="result">Script did not run.</span> |
| <script> |
| var encoding = 'unknown'; |
| if ('à' == '\u00E0') { // 0xE0 |
| if ('' == '\u2122') { // 0x99 |
| if ('þ' == '\u00FE') // 0xFE |
| encoding = 'Windows-1252'; |
| else if ('þ' == '\u015F') |
| encoding = 'Windows-1254'; |
| else if ('þ' == '\u200F') |
| encoding = 'Windows-1256'; |
| else if ('þ' == '\u20AB') |
| encoding = 'Windows-1258'; |
| else |
| encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122'; |
| } else if ('ÿ' == '\u02D9') // 0xFF |
| encoding = 'ISO-8859-3'; |
| else if ('þ' == '\u0177') // 0xFE |
| encoding = 'ISO-8859-14'; |
| else if ('þ' == '\u021B') |
| encoding = 'ISO-8859-16'; |
| else if ('þ' == '\u015F') |
| encoding = 'ISO-8859-9'; |
| else if ('¾' == '\u00BE') // 0xBE |
| encoding = 'ISO-8859-1'; |
| else if ('¾' == '\u0178') |
| encoding = 'ISO-8859-15'; |
| else |
| encoding = 'unknown with 0xE0 = U+00E0'; |
| } else if ('à' == '\u0101') // 0xE0 |
| encoding = 'ISO-8859-10'; |
| else if ('à' == '\u0E40') // 0xE0 |
| encoding = 'ISO-8859-11'; |
| else if ('à' == '\uFFFD') { // 0xE0 |
| if ('âº' == '\u263A') // 0xE2 0x98 0xBA |
| encoding = 'UTF-8'; |
| else |
| encoding = 'unknown (but ASCII-compatible)'; |
| } |
| document.getElementById('encoding').firstChild.data = encoding; |
| var expected = document.getElementById('expected').firstChild.data; |
| if (expected == '(demo - no expected result)') { |
| document.getElementById('result').firstChild.data = 'demo'; |
| } else if (encoding == expected) { |
| document.getElementById('result').firstChild.data = 'PASS'; |
| document.getElementById('result').className = 'pass'; |
| } else { |
| document.getElementById('result').firstChild.data = 'FAIL'; |
| document.getElementById('result').className = 'fail'; |
| } |
| if (parent.receivedResults) |
| parent.receivedResults(); |
| </script> |
| </div> |