Create-url-with-windows-1252-encoding.html (552B)
1 <!doctype html> 2 <meta charset=windows-1252> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script> 6 test(() => { 7 const url = new URL("/", location); 8 url.protocol = "ws"; 9 const input = "?\u20AC"; 10 const expected = url.href + "?%E2%82%AC"; 11 12 let ws = new WebSocket(url.href + input); 13 assert_equals(ws.url, expected); 14 ws.close(); 15 16 ws = new WebSocket("/" + input); 17 assert_equals(ws.url, expected); 18 ws.close(); 19 }, "URL's percent-encoding is always in UTF-8 for WebSocket"); 20 </script>