From 929d55cffe313b0f93c5239a2de7bdc8d15243a4 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sat, 15 Sep 2018 19:38:12 -0400 Subject: [PATCH] Encode whitespace code points correctly in browser tests --- tools/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test.js b/tools/test.js index b4fa8de..8a34819 100644 --- a/tools/test.js +++ b/tools/test.js @@ -10,9 +10,9 @@ function encodeCodePoint(code, fatal) { return 'new EncoderException("", Encoding::E_INVALID_CODE_POINT)'; } else { var l = document.createElement("a"); - l.href = "http://example.com/?" + String.fromCodePoint(code); + l.href = "http://example.com/?" + String.fromCodePoint(code) + "a"; var bytes = []; - let url = l.search.substr(1); + let url = l.search.substr(1, l.search.length - 2); for (let a = 0; a < url.length; a++) { if ((url.charAt(a) == "%" && url.substr(a, 6) == "%26%23") || url.charAt(a) == "&") { // character cannot be encoded