Closed Bug 208546 Opened 21 years ago Closed 21 years ago

POST of a form with hidden field removes trailing linefeed character from value

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 114997

People

(Reporter: gdedwards, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529

I have an HTML form with a hidden field; the value of the field is, say,
"test
test
"

When this form is submitted to the CGI the field is POSTed to the CGI without
the trailing line feed.



Reproducible: Always

Steps to Reproduce:
Here's the example CGI script I used to diagnose the issue.

#!/devl/perl/5.6.1/bin/perl -w

$request_method = $ENV{'REQUEST_METHOD'};

if ($request_method eq "POST") {
    read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
    print "Content-type: text/plain", "\n\n";
    @chars = unpack('C*', $query_string);
    foreach $c (@chars) {
	print "$c " . chr($c) . "\n";
    }
} else {
    print "Content-type: text/html", "\n\n";
    print <<EOF
<HTML>
<HEAD><TITLE>Title</TITLE></HEAD>
<BODY>
<FORM ACTION="/twiki/bin/testcgi" METHOD="POST">
<INPUT TYPE="hidden" NAME="hidden0" VALUE="test&#10;test value&#10;">
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
</BODY></HTML>
EOF
}

Actual Results:  
When I press the submit button I get 

104 h
105 i
100 d
100 d
101 e
110 n
48 0
61 =
116 t
101 e
115 s
116 t
37 %
48 0
68 D
37 %
48 0
65 A
116 t
101 e
115 s
116 t
43 +
118 v
97 a
108 l
117 u
101 e



Expected Results:  
I expected to get back (and, dare I say it, IE5 returns)

104 h
105 i
100 d
100 d
101 e
110 n
48 0
61 =
116 t
101 e
115 s
116 t
37 %
48 0
68 D
37 %
48 0
65 A
116 t
101 e
115 s
116 t
43 +
118 v
97 a
108 l
117 u
101 e
37 %
48 0
68 D
37 %
48 0
65 A

In other words, I expected Mozilla to preserve the value of the text field.

*** This bug has been marked as a duplicate of 114997 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.