| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../js/resources/js-test-pre.js"></script> |
| 3 <script src="resources/shared.js"></script> |
| 4 <script> |
| 5 |
| 6 description("Supersets of ASCII decode ASCII correctly"); |
| 7 |
| 8 encodings = legacy_encodings.slice(); |
| 9 encodings.unshift('utf-8'); |
| 10 |
| 11 // Encodings that have escape codes in 0x00-0x7F |
| 12 var escape_codes = { |
| 13 "hz-gb-2312": [ 0x7E ], |
| 14 "iso-2022-jp": [ 0x1B ], |
| 15 "iso-2022-kr": [ 0x0E, 0x0F, 0x1B ] |
| 16 }; |
| 17 |
| 18 encodings.forEach(function (encoding) { |
| 19 string = ''; |
| 20 decoded = null; |
| 21 bytes = []; |
| 22 for (var i = 0; i < 128; ++i) { |
| 23 if (encoding in escape_codes && escape_codes[encoding].indexOf(i) !== -1
) |
| 24 continue; |
| 25 string += String.fromCharCode(i); |
| 26 bytes.push(i); |
| 27 } |
| 28 evalAndLog("decoder = new TextDecoder('"+encoding+"')"); |
| 29 evalAndLog("decoded = decoder.decode(new Uint8Array(bytes))"); |
| 30 // encodeURIComponent ensures output is printable |
| 31 shouldBe("encodeURIComponent(string)", "encodeURIComponent(decoded)"); |
| 32 }); |
| 33 |
| 34 |
| 35 </script> |
| 36 <script src="../../js/resources/js-test-post.js"></script> |
| OLD | NEW |