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