Murray @ PlanetThoughtful wrote:
> Hi All,
> 
> I'm having an odd problem with formatting of line feeds in an email my
> site automatically sends to me when someone comments on one of my blog
> entries.
> 
> For some reason "\r\n" characters are coming through exactly like that
> in the email, and yet the same value being stored in the backend MySQL
> database seems to represent the carriage-return \ line-feed characters
> as it should.
> 
> A typical example of the value when sent in the email would be:
> 
> Lol, hi Duncan.\r\n\r\nIt\'s possible that this post once had some
> comments. I lost most of PT at one point when my host had a harddrive
> crash, and salvaged a lot of entries from local copies on my computer,
> and notes I\'d scribbled in my journals and so on.\r\n\r\nStill, it\'s
> great to see you commenting on the post that made you a legend on
> PT!\r\n\r\nMuch warmth,\r\n\r\nMr Banderas
> 
> The odd thing is that the rest of the email is correctly interpreting
> line-feed characters, it's only the value entered on the comment form
> that represents CR \ LFs as normal characters.
> 
> I'm not sure if this is the culprit, but because my remote host for this
> site has magic_quotes_gpc on, and my local setup doesn't, I run the
> following function every time a page is requested where form processing
> is performed:
> 
>   function traverse ( &$arr )
>   {
>       if ( !is_array ( $arr ) )
>           return;
> 
>       foreach ( $arr as $key => $val )
>           is_array ( $arr[$key] ) ? traverse ( $arr[$key] ) : (
> $arr[$key] = stripslashes ( $arr[$key] ) );
>   }
> 
> Can anyone give me any thoughts on how to represent these CR \ LF
> characters properly in the email?
> 
> Many thanks,
> 
> Murray
> 



you probably have it surrounded in single quotes, PHP only converts \n
or \r\n when its enclosed within double quotes


James



---------------------------------------------------------

Master CIW Designer          http://www.ciwcertified.com
Zend Certified Engineer      http://www.zend.com


http://www.jamesbenson.co.uk

---------------------------------------------------------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to