[thelist] Plain Text Newsletter in PHP with Problems

Rob Smith rob.smith at THERMON.com
Thu Mar 18 12:51:52 CST 2004


<snip author="Mark">
PHP is possibly automatically decoding the %0D%0A for you, forming a
linebreak
(which probably breaks the 'Location' header).  Try using urlencode(
$subject )
before constructing your url.
</snip>

Cool. Here's what I did:

PreviewNewsletter.php?newsletter=" . urlencode($_GET["$newsletter"]) .
"&Subject....

looks great, but:

   Subject: test 
   Newsletter: This is a test with a hard carriage return 

It lost my hard carriage return :-\

When I reverse engineer the code: urlencode($_GET["$newsletter"]) I get:
This+is+a+test%0D%0Awith+a+hard+carriage+return.

At this point I can do a couple of replace functions and manipulate the
special characters.

My target audience is everyone so I have to go with plain text. My next
question is how do I simulate the hard carriage returns now that I've lost
them with urlencode? 

My first intuition from the PHP manual is using the \n or \r modifiers where
ever I see %0D%0A. 

Do you think this will do it?

Rob


More information about the thelist mailing list