11cb0ef41Sopenharmony_ci<!doctype html>
21cb0ef41Sopenharmony_ci<meta charset=gbk> <!-- if the server overrides this, it is stupid, as this is a testsuite -->
31cb0ef41Sopenharmony_ci<script src=/resources/testharness.js></script>
41cb0ef41Sopenharmony_ci<script src=/resources/testharnessreport.js></script>
51cb0ef41Sopenharmony_ci<script>
61cb0ef41Sopenharmony_ci function encode(input, output, desc) {
71cb0ef41Sopenharmony_ci   test(function() {
81cb0ef41Sopenharmony_ci     const a = document.createElement("a") // <a> uses document encoding for URL's query
91cb0ef41Sopenharmony_ci     a.href = "https://example.com/?" + input;
101cb0ef41Sopenharmony_ci     assert_equals(a.search.substr(1), output); // remove leading "?"
111cb0ef41Sopenharmony_ci   }, "gbk encoder: " + desc);
121cb0ef41Sopenharmony_ci }
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci encode("s", "s", "very basic");
151cb0ef41Sopenharmony_ci encode("\u20AC", "%80", "Euro");
161cb0ef41Sopenharmony_ci encode("\u4E02", "%81@", "character");
171cb0ef41Sopenharmony_ci encode("\uE4C6", "%A1@", "PUA");
181cb0ef41Sopenharmony_ci encode("\uE4C5", "%FE%FE", "PUA #2");
191cb0ef41Sopenharmony_ci encode("\ud83d\udca9", "%26%23128169%3B", "poo");
201cb0ef41Sopenharmony_ci encode("\uE7C8", "%26%2359336%3B", "legacy ICU special case 1");
211cb0ef41Sopenharmony_ci encode("\u2026", "%A1%AD", "legacy ICU special case 2");
221cb0ef41Sopenharmony_ci encode("\uFF5E", "%A1%AB", "legacy ICU special case 3");
231cb0ef41Sopenharmony_ci encode("\u00A5", "%26%23165%3B", "legacy WebKit case 1");
241cb0ef41Sopenharmony_ci encode("\u22EF", "%26%238943%3B", "legacy WebKit case 2");
251cb0ef41Sopenharmony_ci encode("\u301C", "%26%2312316%3B", "legacy WebKit case 3");
261cb0ef41Sopenharmony_ci</script>
27