charset.html (1867B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset=utf-8> 5 <title>Test utf-8 and ASCII cookie parsing</title> 6 <meta name=help href="https://tools.ietf.org/html/rfc6265#section-4.1.1"> 7 <meta name="timeout" content="long"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/resources/testdriver.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <script src="/cookies/resources/cookie-test.js"></script> 13 </head> 14 <body> 15 <div id=log></div> 16 <script> 17 const charsetTests = [ 18 { 19 cookie: "test=1春节回家路·春运完全手册", 20 expected: "test=1春节回家路·春运完全手册", 21 name: "ASCII name and utf-8 value", 22 }, 23 { 24 cookie: "тест=2", 25 expected: "тест=2", 26 name: "utf-8 name and ASCII value", 27 }, 28 { 29 cookie: 'test="3春节回家路·春运完全手册"', 30 expected: 'test="3春节回家路·春运完全手册"', 31 name: "ASCII name and quoted utf-8 value", 32 }, 33 { 34 cookie: "春节回=4家路·春运完全手册", 35 expected: "春节回=4家路·春运完全手册", 36 name: "utf-8 name and value", 37 }, 38 { 39 cookie: '"春节回=5家路·春运完全手册"', 40 expected: '"春节回=5家路·春运完全手册"', 41 name: "quoted utf-8 name and value", 42 }, 43 { 44 cookie: "春节回=6家路·春运; 完全手册", 45 expected: "春节回=6家路·春运", 46 name: "utf-8 name and value, with (invalid) utf-8 attribute", 47 }, 48 ]; 49 50 for (const test of charsetTests) { 51 httpCookieTest(test.cookie, test.expected, test.name); 52 } 53 </script> 54 </body> 55 </html>