charset-2.html (974B)
1 <!DOCTYPE html> 2 <meta charset="windows-1250"> 3 <title>JSON 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"> 8 import json from "../serve-with-content-type.py?fn=json-module/utf-8.json" with { type: "json"}; 9 test(() => { 10 assert_equals(json.data, "śćążź"); 11 }, "JSON module should be loaded as utf-8 even though document's encoding is windows-1250"); 12 </script> 13 <script type="module"> 14 import json from "../serve-with-content-type.py?fn=json-module/windows-1250.json&ct=text/json%3Bcharset=windows-1250" with { type: "json"}; 15 test(() => { 16 assert_not_equals(json.data, "śćążź", 17 'Should be decoded as UTF-8'); 18 }, "JSON module should be loaded as utf-8 even if it is encoded in windows-1250 and served with a windows-1250 charset response header, and this document's encoding is windows-1250"); 19 </script>