11cb0ef41Sopenharmony_ci// META: title=Encoding API: unsupported encodings 21cb0ef41Sopenharmony_ci// META: script=resources/decoding-helpers.js 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ci// Attempting to decode '<' as UTF-7 (+AD4) ends up as '+AD4'. 51cb0ef41Sopenharmony_ci['UTF-7', 'utf-7'].forEach(label => { 61cb0ef41Sopenharmony_ci decode_test(label, '+AD4', 'U+002B/U+0041/U+0044/U+0034', 71cb0ef41Sopenharmony_ci `${label} should not be supported`); 81cb0ef41Sopenharmony_ci}); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci// UTF-32 will be detected as UTF-16LE if leading BOM, or UTF-8 otherwise (due to XMLHttpRequest). 111cb0ef41Sopenharmony_ci['UTF-32', 'utf-32', 'UTF-32LE', 'utf-32le'].forEach(label => { 121cb0ef41Sopenharmony_ci decode_test(label, 131cb0ef41Sopenharmony_ci '%FF%FE%00%00%41%00%00%00%42%00%00%00', 141cb0ef41Sopenharmony_ci 'U+0000/U+0041/U+0000/U+0042/U+0000', 151cb0ef41Sopenharmony_ci `${label} with BOM should decode as UTF-16LE`); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci decode_test(label, 181cb0ef41Sopenharmony_ci '%41%00%00%00%42%00%00%C2%80', 191cb0ef41Sopenharmony_ci 'U+0041/U+0000/U+0000/U+0000/U+0042/U+0000/U+0000/U+0080', 201cb0ef41Sopenharmony_ci `${label} with no BOM should decode as UTF-8`);; 211cb0ef41Sopenharmony_ci}); 221cb0ef41Sopenharmony_ci['UTF-32be', 'utf-32be'].forEach(label => { 231cb0ef41Sopenharmony_ci decode_test(label, 241cb0ef41Sopenharmony_ci '%00%00%00%41%00%00%00%42%C2%80', 251cb0ef41Sopenharmony_ci 'U+0000/U+0000/U+0000/U+0041/U+0000/U+0000/U+0000/U+0042/U+0080', 261cb0ef41Sopenharmony_ci `${label} with no BOM should decode as UTF-8`); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci decode_test(label, 291cb0ef41Sopenharmony_ci '%00%00%FE%FF%00%00%00%41%00%C2%80%42', 301cb0ef41Sopenharmony_ci 'U+0000/U+0000/U+FFFD/U+FFFD/U+0000/U+0000/U+0000/U+0041/U+0000/U+0080/U+0042', 311cb0ef41Sopenharmony_ci `${label} with BOM should decode as UTF-8`); 321cb0ef41Sopenharmony_ci}); 33