I have this simple test page saved as page1.html.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript">
function submitForm() {
alert(escape(document.myform.mytextarea.value));
return true;
}
</script>
</head>
<body>
<form name="myform" action="page2.html" method="post" onsubmit="javascript:return submitForm();">
<textarea name="mytextarea">xxxyyy</textarea>
<input type="submit" value="submitForm">
</form>
</body>
</html>
And this page saved as page2.html.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
Page2.html
</body>
</html>
I open page1.html under Firefox (I think version has no importance, but it is 18.0. And same problem with Chrome or IE 10.0). Before I click the submitForm button, I hit one ENTER between values "xxx" and "yyy" like this.
When I click the submitForm button, the alert shows one character between "xxx" and "yyy" which is the \n encoded as "%0A".
If I have a look into Firebug of what is posted, I can see two characters which are "\r\n" encoded as "%0D%0A".
Can you explain why \n is transformed to \r\n on POST and how to prevent that ? I minimized my problem, but it's really problematic for me.
I could test this under Safari on MAC OS, and I also get %0D%0A on POST.
Under IE 8.0 and before, Javascript alerts %0D%0A and I get %0D%0A on POST, so IE 8.0 and before does not behave the same.