summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/encoding/legacy-mb-schinese/gbk/gbk-encoder.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/encoding/legacy-mb-schinese/gbk/gbk-encoder.html')
-rw-r--r--testing/web-platform/tests/encoding/legacy-mb-schinese/gbk/gbk-encoder.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/web-platform/tests/encoding/legacy-mb-schinese/gbk/gbk-encoder.html b/testing/web-platform/tests/encoding/legacy-mb-schinese/gbk/gbk-encoder.html
new file mode 100644
index 0000000000..e43cb73fea
--- /dev/null
+++ b/testing/web-platform/tests/encoding/legacy-mb-schinese/gbk/gbk-encoder.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset=gbk> <!-- if the server overrides this, it is stupid, as this is a testsuite -->
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ function encode(input, output, desc) {
+ test(function() {
+ const a = document.createElement("a") // <a> uses document encoding for URL's query
+ a.href = "https://example.com/?" + input;
+ assert_equals(a.search.substr(1), output); // remove leading "?"
+ }, "gbk encoder: " + desc);
+ }
+
+ encode("s", "s", "very basic");
+ encode("\u20AC", "%80", "Euro");
+ encode("\u4E02", "%81@", "character");
+ encode("\uE4C6", "%A1@", "PUA");
+ encode("\uE4C5", "%FE%FE", "PUA #2");
+ encode("\ud83d\udca9", "%26%23128169%3B", "poo");
+ encode("\uE7C8", "%26%2359336%3B", "legacy ICU special case 1");
+ encode("\u2026", "%A1%AD", "legacy ICU special case 2");
+ encode("\uFF5E", "%A1%AB", "legacy ICU special case 3");
+ encode("\u00A5", "%26%23165%3B", "legacy WebKit case 1");
+ encode("\u22EF", "%26%238943%3B", "legacy WebKit case 2");
+ encode("\u301C", "%26%2312316%3B", "legacy WebKit case 3");
+</script>