All,
I am trying to build a completely UTF-8 web app which allows users to submit text content.
If I store a text copied on a web form (textarea) into a PHP string $str, and then print this variable, the text is obviously printed without the new lines, carriage returns, or tabs.
Is there a way for me to view those special characters when I print the text?
For example, if the user were to enter:
Two roads diverged in a yellow wood,
And sorry I could not travel both
I’d like to be able to print:
Two roads diverged in a yellow wood,\nAnd sorry I could not travel both
Either echo them into a textarea, or surround them with
<pre>tags. Otherwise, massage the data with nl2br and a custom one for handling tabs: