Skip to content

Commit c70b18e

Browse files
tkent-googleannevk
authored andcommitted
HTML: form's _charset_ handling
HTML change: whatwg/html#3645. URL change: whatwg/url#382.
1 parent 58ee169 commit c70b18e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<head>
3+
<meta charset="utf-8">
4+
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set">
5+
<link ref="help" href="https://xhr.spec.whatwg.org/#dom-formdata">
6+
<link rel="help" href="https://fetch.spec.whatwg.org/#concept-bodyinit-extract">
7+
<script src="/resources/testharness.js"></script>
8+
<script src="/resources/testharnessreport.js"></script>
9+
</head>
10+
<body>
11+
12+
<iframe name="frame1"></iframe>
13+
<form accept-charset="iso-8859-1" target="frame1" action="/common/blank.html">
14+
<input type="hidden" name="_charset_">
15+
</form>
16+
17+
<script>
18+
test(() => {
19+
let formData = new FormData(document.querySelector('form'));
20+
assert_equals(formData.get('_charset_'), 'UTF-8');
21+
}, 'FormData constructor always produces UTF-8 _charset_ value.');
22+
23+
let t = async_test('_charset_ control sets the expected encoding name.');
24+
t.step(() => {
25+
let iframe = document.querySelector('iframe');
26+
iframe.onload = t.step_func_done(() => {
27+
assert_not_equals(iframe.contentDocument.URL.indexOf('_charset_=windows-1252'), -1);
28+
});
29+
document.querySelector('form').submit();
30+
});
31+
</script>
32+
</body>

0 commit comments

Comments
 (0)