Bug 169599
Summary: | LF converted to CRLF when a form is submitted | ||
---|---|---|---|
Product: | WebKit | Reporter: | Victor Bolshov <crocodile2u> |
Component: | Forms | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | annevk, ap, cdumez, hi+webkit, wenson_hsieh |
Priority: | P2 | ||
Version: | WebKit Local Build | ||
Hardware: | PC | ||
OS: | Linux |
Victor Bolshov
When a form is submitted, text from a textarea element that contains "LF" (\n) as line terminators, is transformed: LF is replaced with CRLF (\r\n). It can be extremely annoying when maxlength is specified for a textarea. Imagine that maxlength is set to 100. Text contains exactly 100 symbols and has 2 lines (\n as terminator). Browser checks for maxlength, finds that it is OK, submits the form. But the actual _submitted_ value contains \r\n as terminator, so it is 101 chars. Server-side validation rejects it. We observed the same behavior on Windows as well as on Linux.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
mxdvl
I believe this is as per the spec, submitted forms must encode new lines as CRLF (`\r\n`): https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4
There is however an outstanding bug related to the `maxLength` attribute which does not normalise the textarea value to LF only (`\n`): https://bugs.webkit.org/show_bug.cgi?id=154342. The spec is clear that it should: https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element
Anne van Kesteren
That is now fixed (in bug 249916). And this is indeed INVALID as the specification requires otherwise.