Skip to content

Commit

Permalink
Add test showing GBK decoding differences in Chromium.
Browse files Browse the repository at this point in the history
  • Loading branch information
achristensen07 committed Nov 4, 2020
1 parent 407f04a commit ebdc0b8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions encoding/legacy-mb-schinese/gbk/gbk-decoder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
gbkPointers = [
23834, 23835, 23836, 23837, 23838, 23840, 23841, 23842, 23843, 23844
];
codePoints = [
0x2e84, 0x3473, 0x3447, 0x2e88, 0x2e8b, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97
];
for (i = 0; i < gbkPointers.length; i++) {
pointer = gbkPointers[i];
test(function() {
encoded = [pointer / 190 + 0x81, pointer % 190];
decoded = new TextDecoder("GBK").decode(new Uint8Array(encoded)).charCodeAt(0);
codePoint = codePoints[i];
assert_equals(decoded, codePoint);
}, "gbk pointer: " + pointer)
}
</script>

0 comments on commit ebdc0b8

Please sign in to comment.