Page 1 of 1

Newline and PHP

Posted: Mon Nov 02, 2009 3:54 pm
by calebrash
So I'm trying to account for newline characters and convert them to '<br />' before storing them in the db. However, my newlines are coming in as "%A" instead of '\r' or '\n', for some reason. Calling str_replace() fixes the problem except when the new line starts with 'A'. In that case, the leading 'A' is stored as a superscript 'a' and displays in HTML as a diamond with '?' in the middle (I guess it means some unknown character). I can't get rid of it with str_replace() because of character encoding, and nl2br() just takes care of regular newline characters.

Any help would be fantastic.

Re: Newline and PHP

Posted: Mon Nov 02, 2009 4:08 pm
by Mark Baker
have a look at urldecode(), see if that helps convert your %A correctly

Re: Newline and PHP

Posted: Mon Nov 02, 2009 4:51 pm
by Mirge