blob: 110f8eedcbad33b0b3917d087c7df9283bfe5fe3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
<!DOCTYPE HTML>
<meta http-equiv="Content-Type" content="text/html;charset0charset=ISO-8859-9">
<p>Test:
<pre><!DOCTYPE HTML>
<meta http-equiv="Content-Type" content="text/html;charset0charset=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>
|