Quantcast
Viewing all articles
Browse latest Browse all 21

PHP: Is it ok to replace \r\n with \n?

I have a form with a textarea and a JS character counter. Yet the backend script claims that the strlen of the message is longer than the JS character counter claimed. The reason for this, I have discovered, is that the backend sees every newline character as \r\n which is two characters.

Can I simply have it do a str_replace("\r\n","\n",$input)? Or will this cause windows-users to see the string all on one line? Is there any reason why I should not do this?


Viewing all articles
Browse latest Browse all 21

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>