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