11cb0ef41Sopenharmony_ci<!doctype html> 21cb0ef41Sopenharmony_ci<meta charset=iso-2022-jp> <!-- 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<div id=log></div> 61cb0ef41Sopenharmony_ci<script> 71cb0ef41Sopenharmony_ci function encode(input, output, desc) { 81cb0ef41Sopenharmony_ci test(function() { 91cb0ef41Sopenharmony_ci var a = document.createElement("a") // <a> uses document encoding for URL's query 101cb0ef41Sopenharmony_ci a.href = "https://example.com/?" + input 111cb0ef41Sopenharmony_ci assert_equals(a.search.substr(1), output) // remove leading "?" 121cb0ef41Sopenharmony_ci }, "iso-2022-jp encoder: " + desc) 131cb0ef41Sopenharmony_ci } 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci encode("s", "s", "very basic"); 161cb0ef41Sopenharmony_ci encode("\u00A5\u203Es\\\uFF90\u4F69", "%1B(J\\~s%1B(B\\%1B$B%_PP%1B(B", "basics"); 171cb0ef41Sopenharmony_ci encode("\uFF61", "%1B$B!%23%1B(B", "Katakana"); 181cb0ef41Sopenharmony_ci encode("\u0393", "%1B$B&%23%1B(B", "jis0208"); 191cb0ef41Sopenharmony_ci encode("\x0E\x0F\x1Bx", "%26%2365533%3B%26%2365533%3B%26%2365533%3Bx", "SO/SI ESC"); 201cb0ef41Sopenharmony_ci encode("\u203E\x0E\x0F\x1Bx", "%1B(J~%26%2365533%3B%26%2365533%3B%26%2365533%3Bx%1B(B", "Roman SO/SI ESC"); 211cb0ef41Sopenharmony_ci encode("\uFF61\x0E\x0F\x1Bx", "%1B$B!%23%1B(B%26%2365533%3B%26%2365533%3B%26%2365533%3Bx", "Katakana SO/SI ESC"); 221cb0ef41Sopenharmony_ci encode("\u0393\x0E\x0F\x1Bx", "%1B$B&%23%1B(B%26%2365533%3B%26%2365533%3B%26%2365533%3Bx", "jis0208 SO/SI ESC"); 231cb0ef41Sopenharmony_ci encode("\uFFFD", "%26%2365533%3B", "U+FFFD"); 241cb0ef41Sopenharmony_ci encode("\u203E\uFFFD", "%1B(J~%26%2365533%3B%1B(B", "Roman U+FFFD"); 251cb0ef41Sopenharmony_ci encode("\uFF61\uFFFD", "%1B$B!%23%1B(B%26%2365533%3B", "Katakana U+FFFD"); 261cb0ef41Sopenharmony_ci encode("\u0393\uFFFD", "%1B$B&%23%1B(B%26%2365533%3B", "jis0208 U+FFFD"); 271cb0ef41Sopenharmony_ci</script> 28