-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathsjis-decode-sjis.html
60 lines (52 loc) · 1.57 KB
/
sjis-decode-sjis.html
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
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="utf-8"/>
<title>sjis decoding</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'sjis' as for a document labeled 'shift_jis'.">
<style>
iframe { display:none }
</style>
<script src="jis0208_index.js"></script>
<script src="sjis-decoder.js"></script>
</head>
<body onload="showNodes();">
<iframe src="sjis_chars-sjis.html" name="scriptWindow" id="scrwin"></iframe>
<div id="log"></div>
<script>
var tests = [];
function iframeRef(frameRef) {
return frameRef.contentWindow
? frameRef.contentWindow.document
: frameRef.contentDocument;
}
function showNodes() {
var iframe = iframeRef(document.getElementById("scrwin"));
nodes = iframe.querySelectorAll("span");
for (var i = 0; i < nodes.length; i++) {
tests[i] = async_test(
"U+" +
nodes[i].dataset.cp +
" " +
String.fromCodePoint(parseInt(nodes[i].dataset.cp, 16)) +
" " +
sjisDecoder(nodes[i].dataset.bytes) +
" " +
nodes[i].dataset.bytes
);
}
for (var i = 0; i < nodes.length; i++) {
tests[i].step(function() {
assert_equals(nodes[i].textContent, sjisDecoder(nodes[i].dataset.bytes));
});
tests[i].done();
}
}
</script>
</body>
</html>