big5-decode-errors.html (2411B)
1 <!DOCTYPE html> 2 <html lang="en-GB"> 3 <head> 4 <meta charset="utf-8"/> 5 <title>Big5 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/#big5"> 11 <meta name="assert" content="The browser decodes characters that are not recognised from the big5 encoding as replacement characters."> 12 <style> 13 iframe { display:none } 14 </style> 15 </head> 16 17 <body onload="showNodes();"> 18 19 <iframe src="big5_errors.html" name="scriptWindow" id="scrwin"></iframe> 20 21 <div id="log"></div> 22 23 <script> 24 var tests = []; 25 26 function iframeRef(frameRef) { 27 return frameRef.contentWindow 28 ? frameRef.contentWindow.document 29 : frameRef.contentDocument; 30 } 31 32 function showNodes() { 33 var iframe = iframeRef(document.getElementById("scrwin")); 34 nodes = iframe.querySelectorAll("span"); 35 36 t = -1; 37 t++; 38 tests[t] = async_test("lead not 0x00 and no more bytes: AB"); 39 t++; 40 tests[t] = async_test("lead not 0x00 and no more bytes: AB B5 AB"); 41 t++; 42 tests[t] = async_test("lead not 0x00 and no more bytes: AB AB AB"); 43 44 t++; 45 tests[t] = async_test("lead byte outside 0x81-0xFE: FF"); 46 t++; 47 tests[t] = async_test("lead byte outside 0x81-0xFE: AB AB FF"); 48 49 t++; 50 tests[t] = async_test("trail byte outside 0x41-0xFE: AB 31"); 51 t++; 52 tests[t] = async_test("trail byte outside 0x41-0xFE: AB FF"); 53 54 t++; 55 tests[t] = async_test("pointer is null: C8 F2"); 56 57 t = -1; 58 t++; 59 tests[t].step(function() { 60 assert_equals(nodes[t].textContent, "�"); 61 }); 62 tests[t].done(); 63 t++; 64 tests[t].step(function() { 65 assert_equals(nodes[t].textContent, "奏�"); 66 }); 67 tests[t].done(); 68 t++; 69 tests[t].step(function() { 70 assert_equals(nodes[t].textContent, "垂�"); 71 }); 72 tests[t].done(); 73 t++; 74 tests[t].step(function() { 75 assert_equals(nodes[t].textContent, "�"); 76 }); 77 tests[t].done(); 78 t++; 79 tests[t].step(function() { 80 assert_equals(nodes[t].textContent, "奏�"); 81 }); 82 tests[t].done(); 83 t++; 84 tests[t].step(function() { 85 assert_equals(nodes[t].textContent, "�1"); 86 }); 87 tests[t].done(); 88 t++; 89 tests[t].step(function() { 90 assert_equals(nodes[t].textContent, "�"); 91 }); 92 tests[t].done(); 93 t++; 94 tests[t].step(function() { 95 assert_equals(nodes[t].textContent, "�"); 96 }); 97 tests[t].done(); 98 } 99 </script> 100 101 </body> 102 </html>