1<!DOCTYPE html> 2<html lang="en-GB"> 3<head> 4<meta charset="utf-8"/> 5<title>Shift_jis decoding errors</title> 6<meta name="timeout" content="long"> 7<script src="/resources/testharness.js"></script> 8<script src="/resources/testharnessreport.js"></script> 9<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> 10<link rel="help" href="https://encoding.spec.whatwg.org/#shift_jis"> 11<meta name="assert" content="The browser decodes characters that are not recognised from the shift_jis index as replacement characters."> 12<style> 13 iframe { display:none } 14 form { display:none } 15</style> 16</head> 17 18<body onload="showNodes();"> 19 20<iframe src="sjis_errors.html" name="scriptWindow" id="scrwin"></iframe> 21 22<div id="log"></div> 23 24<script> 25var tests = []; 26 27function iframeRef(frameRef) { 28 return frameRef.contentWindow 29 ? frameRef.contentWindow.document 30 : frameRef.contentDocument; 31} 32 33function showNodes() { 34 var iframe = iframeRef(document.getElementById("scrwin")); 35 nodes = iframe.querySelectorAll("span"); 36 37 t = -1; 38 t++; 39 tests[t] = async_test("lead not 0x00 and no more bytes: FA"); 40 t++; 41 tests[t] = async_test("lead not 0x00 and no more bytes: FA 6E FA"); 42 t++; 43 tests[t] = async_test("lead not 0x00 and no more bytes: FA FA FA"); 44 45 t++; 46 tests[t] = async_test("lead byte outside 0x81-0x9F,0xA1-0xDF,0xE0,0xFC: FF"); 47 t++; 48 tests[t] = async_test("lead byte outside 0x81-0x9F,0xA1-0xDF,0xE0,0xFC: A0"); 49 t++; 50 tests[t] = async_test("lead byte outside 0x81-0x9F,0xA1-0xDF,0xE0,0xFC: E1"); 51 t++; 52 tests[t] = async_test( 53 "lead byte outside 0x81-0x9F,0xA1-0xDF,0xE0,0xFC: FA FA FF" 54 ); 55 56 t++; 57 tests[t] = async_test("trail byte outside 0x41-0xFE: FA FD"); 58 t++; 59 tests[t] = async_test("trail byte outside 0x41-0xFE: FA FE"); 60 61 t++; 62 tests[t] = async_test("pointer is null: 81 B5"); 63 64 t = -1; 65 t++; 66 tests[t].step(function() { 67 assert_equals(nodes[t].textContent, "�"); 68 }); 69 tests[t].done(); 70 t++; 71 tests[t].step(function() { 72 assert_equals(nodes[t].textContent, "佖�"); 73 }); 74 tests[t].done(); 75 t++; 76 tests[t].step(function() { 77 assert_equals(nodes[t].textContent, "洄�"); 78 }); 79 tests[t].done(); 80 t++; 81 tests[t].step(function() { 82 assert_equals(nodes[t].textContent, "�"); 83 }); 84 tests[t].done(); 85 t++; 86 tests[t].step(function() { 87 assert_equals(nodes[t].textContent, "�"); 88 }); 89 tests[t].done(); 90 t++; 91 tests[t].step(function() { 92 assert_equals(nodes[t].textContent, "�"); 93 }); 94 tests[t].done(); 95 t++; 96 tests[t].step(function() { 97 assert_equals(nodes[t].textContent, "洄�"); 98 }); 99 tests[t].done(); 100 t++; 101 tests[t].step(function() { 102 assert_equals(nodes[t].textContent, "�"); 103 }); 104 tests[t].done(); 105 t++; 106 tests[t].step(function() { 107 assert_equals(nodes[t].textContent, "�"); 108 }); 109 tests[t].done(); 110 t++; 111 tests[t].step(function() { 112 assert_equals(nodes[t].textContent, "�"); 113 }); 114 tests[t].done(); 115} 116</script> 117</body> 118</html> 119