Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[encoding] Tests for BOM detection. #22276

Merged
merged 4 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions encoding/bom-handling.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- starts with a BOM -->
<!doctype html>
<meta charset="windows-1252">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<title>BOM handling</title>
<div id=log></div>
<div id=content>これは文字実験です。</div>
<script>

test(
() => {
assert_equals(
document.getElementById("content").textContent,
"\u3053\u308C\u306F\u6587\u5B57\u5B9F\u9A13\u3067\u3059\u3002"
);
},
"The BOM should override any other encoding declarations."
);

test(
() => {
assert_equals(document.characterSet.toLowerCase(), "utf-8");
},
"document.characterSet should match the BOM"
);

</script>
andreubotella marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions encoding/bom-handling.html.headers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Content-Type: text/html; charset=windows-1252
andreubotella marked this conversation as resolved.
Show resolved Hide resolved