2 <meta charset=big5
> <!-- test breaks if the server overrides this -->
3 <script src=/resources/testharness.js
></script>
4 <script src=/resources/testharnessreport.js
></script>
7 function encode(input
, output
, desc
) {
9 var a
= document
.createElement("a"); // <a> uses document encoding for URL's query
10 // Append and prepend X to test for off-by-one errors
11 a
.href
= "https://example.com/?X" + input
+ "X";
12 assert_equals(a
.search
.substr(1), "X" + output
+ "X"); // remove leading "?"
13 }, "big5 encoder: " + desc
);
16 encode("ab", "ab", "very basic")
18 encode("\u9EA6", "%26%2340614%3B", "Highest-pointer BMP character excluded from encoder");
19 encode("\uD858\uDE6B", "%26%23156267%3B", "Highest-pointer character excluded from encoder");
20 encode("\u3000", "%A1@", "Lowest-pointer character included in encoder");
21 encode("\u20AC", "%A3%E1", "Euro; the highest-pointer character before a range of 30 unmapped pointers");
22 encode("\u4E00", "%A4@", "The lowest-pointer character after the range of 30 unmapped pointers");
23 encode("\uD85D\uDE07", "%C8%A4", "The highest-pointer character before a range of 41 unmapped pointers");
24 encode("\uFFE2", "%C8%CD", "The lowest-pointer character after the range of 41 unmapped pointers");
25 encode("\u79D4", "%FE%FE", "The last character in the index");
27 encode("\u2603", "%26%239731%3B", "The canonical BMP test character that is not in the index");
28 encode("\uD83D\uDCA9", "%26%23128169%3B", "The canonical astral test character that is not in the index");
30 encode("\uD840\uDFB5", "%FDj", "A Plane 2 character whose low 16 bits match a BMP character that has a lower pointer");
32 encode("\u2550", "%F9%F9", "A duplicate-mapped code point that prefers the highest pointer in the encoder");