OLD | NEW |
1 Test invalid UTF-16 surrogate pairs with UTF-8 encoding | 1 Test invalid UTF-16 surrogate pairs with UTF-8 encoding |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 encoded = new TextEncoder('utf-8').encode("abc123") | 6 encoded = new TextEncoder('utf-8').encode('abc123') |
7 decoded = new TextDecoder('utf-8').decode(encoded) | 7 PASS JSON.stringify([].slice.call(encoded)) is "[97,98,99,49,50,51]" |
8 PASS decoded is "abc123" | |
9 | 8 |
10 encoded = new TextEncoder('utf-8').encode("���") | 9 encoded = new TextEncoder('utf-8').encode('\ud800') |
11 decoded = new TextDecoder('utf-8').decode(encoded) | 10 PASS JSON.stringify([].slice.call(encoded)) is "[239,191,189]" |
12 FAIL decoded should be �. Was ���. | |
13 | 11 |
14 encoded = new TextEncoder('utf-8').encode("���") | 12 encoded = new TextEncoder('utf-8').encode('\udc00') |
15 decoded = new TextDecoder('utf-8').decode(encoded) | 13 PASS JSON.stringify([].slice.call(encoded)) is "[239,191,189]" |
16 FAIL decoded should be �. Was ���. | |
17 | 14 |
18 encoded = new TextEncoder('utf-8').encode("abc���def") | 15 encoded = new TextEncoder('utf-8').encode('abc\ud800123') |
19 decoded = new TextDecoder('utf-8').decode(encoded) | 16 PASS JSON.stringify([].slice.call(encoded)) is "[97,98,99,239,191,189,49,50,51]" |
20 FAIL decoded should be abc�def. Was abc���def. | |
21 | 17 |
22 encoded = new TextEncoder('utf-8').encode("abc���def") | 18 encoded = new TextEncoder('utf-8').encode('abc\udc00123') |
23 decoded = new TextDecoder('utf-8').decode(encoded) | 19 PASS JSON.stringify([].slice.call(encoded)) is "[97,98,99,239,191,189,49,50,51]" |
24 FAIL decoded should be abc�def. Was abc���def. | |
25 | 20 |
26 encoded = new TextEncoder('utf-8').encode("������") | 21 encoded = new TextEncoder('utf-8').encode('\udc00\ud800') |
27 decoded = new TextDecoder('utf-8').decode(encoded) | 22 PASS JSON.stringify([].slice.call(encoded)) is "[239,191,189,239,191,189]" |
28 FAIL decoded should be ��. Was ������. | |
29 | 23 |
30 PASS successfullyParsed is true | 24 PASS successfullyParsed is true |
31 | 25 |
32 TEST COMPLETE | 26 TEST COMPLETE |
33 | 27 |
OLD | NEW |