blob: b5815fd41b7f35de44b628580be5226eb8f8a15e [file] [log] [blame]
<!DOCTYPE html>
<title>Encoding API: Latin-1 decoders</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="resources/encodings.js"></script>
<script>
// Blink uses separate decoder object intances for these encoding aliases,
// so test that they are behaving identically.
test(function() {
var labels;
encodings_table.forEach(function(section) {
section.encodings.forEach(function(encoding) {
if (encoding.name === 'windows-1252')
labels = encoding.labels;
});
});
labels = labels.filter(function(label) { return label !== 'windows-1252'; });
var array = new Uint8Array(256);
for (var cp = 0; cp <= 255; ++cp) {
array[cp] = cp;
}
var windows1252 = new TextDecoder('windows-1252');
labels.forEach(function(label) {
var decoder = new TextDecoder(label);
assert_equals(decoder.decode(array), windows1252.decode(array));
});
}, 'Latin-1 decoders (windows-1252, iso-8859-1, us-ascii, etc) decode identically.');
</script>