WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
169599
LF converted to CRLF when a form is submitted
https://bugs.webkit.org/show_bug.cgi?id=169599
Summary
LF converted to CRLF when a form is submitted
Victor Bolshov
Reported
2017-03-14 06:37:19 PDT
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
Comment 1
2023-08-27 04:42:04 PDT
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
Comment 2
2023-09-01 04:42:48 PDT
That is now fixed (in
bug 249916
). And this is indeed INVALID as the specification requires otherwise.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug