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.
Newline and PHP
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: Newline and PHP
have a look at urldecode(), see if that helps convert your %A correctly
Re: Newline and PHP
Also see: http://us.php.net/nl2br/