Before this change, newlines in form entries were normalized early in the form submission process (during the entry list construction), with an additional late normalization happening as the form payload was encoded with the application/x-www-form-urlencoded enctype. With this change, the early normalization is removed and the late normalization is extended to all enctypes.

Motivation

This solves a long-standing interoperability issue, where Gecko and WebKit normalized newlines late, but the spec only normalized them early, and Chrome did early normalization as well as late normalization for application/x-www-form-urlencoded. In https://github.com/whatwg/html/pull/6287 and https://github.com/whatwg/html/pull/6624 it was decided to standardize Gecko's and WebKit's behavior. Since this change simply moves the normalization from one stage in the form submission algorithm to another, regular form submissions won’t be affected. However, constructing a FormData from a form used to apply early normalization, and so inspecting such a FormData object will result in newlines showing up as \n or \r rather than \r\n. Similarly, form payloads with entries added from Javascript through FromData objects (by passing a FormData body to fetch(), with the formdata event or with form-associated custom elements) will result in those new entries being normalized to \r\n in the encoded payload.

Documentation

Specification

Specification link


Final published standard: Recommendation, Living Standard, Candidate Recommendation, or similar final form

Status in Chromium

Blink


Enabled by default (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • Shipped/Shipping
  • Shipped/Shipping
  • No signals

Owners

Search tags

normalization, html, forms, newline, FormData,

Last updated on 2021-11-28