Skip to main content

Bug Tracker

Side navigation

#6876 closed bug (fixed)

Opened August 05, 2010 05:31PM UTC

Closed December 31, 2010 08:03PM UTC

Last modified November 20, 2013 05:08PM UTC

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.

Attachments (0)
Change History (7)

Changed August 06, 2010 12:30AM UTC by dmethvin comment:1

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:, 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.

Changed October 21, 2010 02:18AM UTC by addyosmani comment:2

keywords: formform newline crlf pair
priority: → undecided
status: newopen

Marking for review and possible inclusion in 1.5.

Changed December 27, 2010 10:37PM UTC by rwaldron comment:3

keywords: form newline crlf pairform,newline,crlf,pair,ajaxrewrite

Changed December 31, 2010 01:02AM UTC by dmethvin comment:4

owner: → dmethvin
status: openassigned

Changed December 31, 2010 08:03PM UTC by Dave Methvin comment:5

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

Changed January 31, 2011 04:26PM UTC by john comment:6

priority: undecidedlow

Changed November 20, 2013 05:08PM UTC by dmethvin comment:7

#14560 is a duplicate of this ticket.