| Index: LayoutTests/fast/encoding/api/ascii-supersets.html
|
| diff --git a/LayoutTests/fast/encoding/api/ascii-supersets.html b/LayoutTests/fast/encoding/api/ascii-supersets.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c9f6f2e6337b582729de2506cc7795bad6177095
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/encoding/api/ascii-supersets.html
|
| @@ -0,0 +1,36 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../js/resources/js-test-pre.js"></script>
|
| +<script src="resources/shared.js"></script>
|
| +<script>
|
| +
|
| +description("Supersets of ASCII decode ASCII correctly");
|
| +
|
| +encodings = legacy_encodings.slice();
|
| +encodings.unshift('utf-8');
|
| +
|
| +// Encodings that have escape codes in 0x00-0x7F
|
| +var escape_codes = {
|
| + "hz-gb-2312": [ 0x7E ],
|
| + "iso-2022-jp": [ 0x1B ],
|
| + "iso-2022-kr": [ 0x0E, 0x0F, 0x1B ]
|
| +};
|
| +
|
| +encodings.forEach(function (encoding) {
|
| + string = '';
|
| + decoded = null;
|
| + bytes = [];
|
| + for (var i = 0; i < 128; ++i) {
|
| + if (encoding in escape_codes && escape_codes[encoding].indexOf(i) !== -1)
|
| + continue;
|
| + string += String.fromCharCode(i);
|
| + bytes.push(i);
|
| + }
|
| + evalAndLog("decoder = new TextDecoder('"+encoding+"')");
|
| + evalAndLog("decoded = decoder.decode(new Uint8Array(bytes))");
|
| + // encodeURIComponent ensures output is printable
|
| + shouldBe("encodeURIComponent(string)", "encodeURIComponent(decoded)");
|
| +});
|
| +
|
| +
|
| +</script>
|
| +<script src="../../js/resources/js-test-post.js"></script>
|
|
|