Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 9 years ago

#6876 closed bug (fixed)

Newline in form data should be encoded as CRLF pair

Reported by: dmethvin Owned by: dmethvin
Priority: low Milestone: 1.5
Component: ajax Version: 1.4.2
Keywords: form, newline, crlf, pair, ajaxrewrite Cc:
Blocked by: Blocking:


See this post:


Summary: The .value property of a textarea returns only LF between lines on all browsers but IE/Opera, but the W3C says lines should be delimited by CRLF when the form is submitted.


Change History (7)

comment:1 Changed 13 years ago by dmethvin

As I read the spec, it seems like *all* line breaks of LF should be replaced with CRLF, which makes the fix easier than special-casing a textarea.

Looks like this could be fixed in serializeArray:

 { name: elem.name, value: val.replace(/\r?\n/g, "\r\n") };

(In two places...)

Another possibility would be to fix it in .val(), which is currently normalizing line endings by removing the CR in browsers where it's present -- IE and Opera. I like that fix better in some ways but am concerned that it will break too much existing code that expects a lone LF.

comment:2 Changed 12 years ago by addyosmani

Keywords: newline crlf pair added
Priority: undecided
Status: newopen

Marking for review and possible inclusion in 1.5.

comment:3 Changed 12 years ago by Rick Waldron

Keywords: ajaxrewrite added

comment:4 Changed 12 years ago by dmethvin

Owner: set to dmethvin
Status: openassigned

comment:5 Changed 12 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

When serializing text, encode all line breaks as CRLF pairs per the application/x-www-form-urlencoded specification. Fixes #6876.

Changeset: eed3803c98bf5c074e40aad12f2e91435bf81154

comment:6 Changed 12 years ago by john

Priority: undecidedlow

comment:7 Changed 9 years ago by dmethvin

#14560 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.