1

I have a simple PHP form in which text with line breaks has Windows line breaks (\r\n) instead of linux line breaks (\n). Client and server are both the same machine running Ubuntu.

The PHP script:

<form action="" method="POST">
    <textarea name="q"><?= htmlentities(@$_REQUEST['q']); ?></textarea>
    <input type="submit"/>
</form>
<hr />
<?= urlencode(@$_REQUEST['q']); ?>

The test:

  • focus textarea

  • press ENTER on keyboard

  • click submit button with mouse

Expected result:

  • %0A

Actual result:

  • %0D%0A

System environment:

  • Ubuntu 16.04 on my PC which is also the scripts host and

  • Firefox 50.1.0 or Chromium 55.0.2883.87, and

  • PHP 7.0.8

Which software part is responsible for that?

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
MonkeyMonkey
  • 826
  • 1
  • 6
  • 19

0 Answers0