charset.html (2165B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>CSS modules: UTF-8 decoding</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id=log></div> 7 <script type="module" onerror="unreachable()"> 8 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=utf-8" with { type: "css"}; 9 test(() => { 10 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\""); 11 }, "CSS module should be loaded as utf-8 when charset=utf8 is specified"); 12 </script> 13 <script type="module" onerror="unreachable()"> 14 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=shift-jis" with { type: "css"}; 15 test(() => { 16 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\""); 17 }, "CSS module should be loaded as utf-8 when charset=shift-jis is specified"); 18 </script> 19 <script type="module" onerror="unreachable()"> 20 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=windows-1252" with { type: "css"}; 21 test(() => { 22 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\""); 23 }, "CSS module should be loaded as utf-8 when charset=windows-1252 is specified"); 24 </script> 25 <script type="module" onerror="unreachable()"> 26 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=utf-7" with { type: "css"};; 27 test(() => { 28 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\""); 29 }, "CSS module should be loaded as utf-8 when charset=utf-7 is specified"); 30 </script> 31 <script type="module" onerror="unreachable()"> 32 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/windows-1250.css&ct=text/css%3Bcharset=windows-1250" with { type: "css"}; 33 test(() => { 34 assert_not_equals(styleSheet.rules[0].style.content, "\"śćążź\"", 35 'Should be decoded as UTF-8'); 36 }, "CSS module should be loaded as utf-8 even if it is encoded in windows-1250 and served with a windows-1250 charset response header"); 37 </script>