| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
| 3 <script src="resources/char-decoding-utils.js"></script> | 3 <script src="resources/char-decoding-utils.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 description("Test encoding behavior for truncated sequences"); | 6 description("Test encoding behavior for truncated sequences"); |
| 7 | 7 |
| 8 // UTF-8 codec emits replacement characters | 8 // UTF-8 codec emits replacement characters |
| 9 testDecode('utf-8', '%E2%88%9A', 'U+221A'); | 9 testDecode('utf-8', '%E2%88%9A', 'U+221A'); |
| 10 testDecode('utf-8', '%E2%88', 'U+FFFD/U+FFFD'); | 10 testDecode('utf-8', '%E2%88', 'U+FFFD/U+FFFD'); |
| 11 testDecode('utf-8', '%E2', 'U+FFFD'); | 11 testDecode('utf-8', '%E2', 'U+FFFD'); |
| 12 | 12 |
| 13 // UTF-16 codec does not emit replacement characters | 13 // UTF-16 codec does not emit replacement characters |
| 14 testDecode('utf-16', '%69%D8%D6%DE', 'U+D869/U+DED6'); | 14 testDecode('utf-16', '%69%D8%D6%DE', 'U+D869/U+DED6'); |
| 15 testDecode('utf-16', '%69%D8%D6', 'U+D869'); | 15 testDecode('utf-16', '%69%D8%D6', 'U+FFFD'); |
| 16 testDecode('utf-16', '%69%D8', 'U+D869'); | 16 testDecode('utf-16', '%69%D8', 'U+FFFD'); |
| 17 testDecode('utf-16', '%69', ''); | 17 testDecode('utf-16', '%69', 'U+FFFD'); |
| 18 testDecode('utf-16be', '%D8%69%DE%D6', 'U+D869/U+DED6'); | 18 testDecode('utf-16be', '%D8%69%DE%D6', 'U+D869/U+DED6'); |
| 19 testDecode('utf-16be', '%D8%69%DE', 'U+D869'); | 19 testDecode('utf-16be', '%D8%69%DE', 'U+FFFD'); |
| 20 testDecode('utf-16be', '%D8%69', 'U+D869'); | 20 testDecode('utf-16be', '%D8%69', 'U+FFFD'); |
| 21 testDecode('utf-16be', '%D8', ''); | 21 testDecode('utf-16be', '%D8', 'U+FFFD'); |
| 22 | 22 |
| 23 // Other codecs emit replacement characters | 23 // Other codecs emit replacement characters |
| 24 testDecode('gb2312', '%A3%A0', 'U+3000'); | 24 testDecode('gb2312', '%A3%A0', 'U+3000'); |
| 25 testDecode('gb2312', '%A3', 'U+FFFD'); | 25 testDecode('gb2312', '%A3', 'U+FFFD'); |
| 26 testDecode('shift_jis', '%82%d0', 'U+3072'); | 26 testDecode('shift_jis', '%82%d0', 'U+3072'); |
| 27 testDecode('shift_jis', '%82', 'U+001A'); | 27 testDecode('shift_jis', '%82', 'U+001A'); |
| 28 testDecode('windows-949', '%A2%E6', 'U+20AC'); | 28 testDecode('windows-949', '%A2%E6', 'U+20AC'); |
| 29 testDecode('windows-949', '%A2', 'U+FFFD'); | 29 testDecode('windows-949', '%A2', 'U+FFFD'); |
| 30 | 30 |
| 31 </script> | 31 </script> |
| OLD | NEW |