Re: [PHP] Whitespace in Emails
On Tue, December 12, 2006 2:23 pm, [EMAIL PROTECTED] wrote: I'm experiencing a strange problem and difficult to diagnose because it's random. I have built an application that sends out an email with a nice amount of text (don't have exact char count, but could get it). On the html email, a random whitespace appears in the content, but always toward the end pointing to a possible character count issue. See below for examples of how the space wanders and is random: 1- Th ere are several things being discussed in this email. 2- There are se veral things being discussed in this email. 3- There are severa l things being discussed in this email. This whitepace issue happens after the email is sent. Anybody have any ideas? If you have confirmed that it's happening AFTER php sends the email, then you can be pretty sure it's not PHP doing it... Also, sending html enhanced (cough, cough) email is probably the First Problem. :-) :-) :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Whitespace in Emails
I'm experiencing a strange problem and difficult to diagnose because it's random. I have built an application that sends out an email with a nice amount of text (don't have exact char count, but could get it). On the html email, a random whitespace appears in the content, but always toward the end pointing to a possible character count issue. See below for examples of how the space wanders and is random: 1- Th ere are several things being discussed in this email. 2- There are se veral things being discussed in this email. 3- There are severa l things being discussed in this email. This whitepace issue happens after the email is sent. Anybody have any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whitespace in Emails
[EMAIL PROTECTED] wrote: I'm experiencing a strange problem and difficult to diagnose because it's random. I have built an application that sends out an email with a nice amount of text (don't have exact char count, but could get it). On the html email, a random whitespace appears in the content, but always toward the end pointing to a possible character count issue. See below for examples of how the space wanders and is random: 1- Th ere are several things being discussed in this email. 2- There are se veral things being discussed in this email. 3- There are severa l things being discussed in this email. This whitepace issue happens after the email is sent. Anybody have any ideas? The MTA is wrapping the text at 1,024 characters if you're not doing it. Use http://php.net/wordwrap to wrap it at specific lengths. If it's a text-only email, add 'format=flowed;' to your headers: Content-Type: text/plain; format=flowed; -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Whitespace filter
Does anyone have an eloquent way to strip redundant whitespace without harming whitespace inside pre, textarea or script tags? I'd like to post-filter my HTML before returning it to the client and I'm not all that great with regular expressions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whitespace filter
Justin Hendrickson mailto:[EMAIL PROTECTED] on Friday, December 05, 2003 5:51 AM said: Does anyone have an eloquent way to strip redundant whitespace without harming whitespace inside pre, textarea or script tags? I'd like to post-filter my HTML before returning it to the client and I'm not all that great with regular expressions. If it's just white space on the ends of the text you can use trim(). As for a regular expression... /\s{2,}|\t/ / Will replace 2 or more whitespace characters (tab, space) with just one space as well as replacing one tab character \t with one space. That works in Perl (me thinks), but you'll have to fenagle it to work with ereg_replace() in PHP. Note, thiw will also rip through pre, textarea, and any other tag. It will apply to the entire string you supply it with. Unless you have gobs of white space in your HTML there's really no point in getting rid of it since all browsers will only display one space even if they encounter multiple spaces. For example: HTML: This ismy HTML. Will display as... This is my HTML. ...in any browser. Chris. p.s. My regex is fairly weak so there could very well be a better one for this. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whitespace filter
You can also use the tidy extension. http://pecl.php.net/package-info.php?package=tidy John On Fri, 2003-12-05 at 20:23, Chris W. Parker wrote: Justin Hendrickson mailto:[EMAIL PROTECTED] on Friday, December 05, 2003 5:51 AM said: Does anyone have an eloquent way to strip redundant whitespace without harming whitespace inside pre, textarea or script tags? I'd like to post-filter my HTML before returning it to the client and I'm not all that great with regular expressions. If it's just white space on the ends of the text you can use trim(). As for a regular expression... /\s{2,}|\t/ / Will replace 2 or more whitespace characters (tab, space) with just one space as well as replacing one tab character \t with one space. That works in Perl (me thinks), but you'll have to fenagle it to work with ereg_replace() in PHP. Note, thiw will also rip through pre, textarea, and any other tag. It will apply to the entire string you supply it with. Unless you have gobs of white space in your HTML there's really no point in getting rid of it since all browsers will only display one space even if they encounter multiple spaces. For example: HTML: This ismy HTML. Will display as... This is my HTML. ...in any browser. Chris. p.s. My regex is fairly weak so there could very well be a better one for this. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- John Coggeshall http://www.coggeshall.org/ The PHP Developer's Handbookhttp://www.php-handbook.com/ -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] whitespace...
How do I remove the whitespace from a document? I consulted the manual and it said to use the trim function. But in a large PHP document, with lots of fuctions etc in PHP... is there a simple way to compress the whitespace of the entire document? Rather than going through each var and using the trim? Like add a header at the top: ?PHP compresswhitespace() ? If you have a 300k php document, won't the source code reveal (after the browser displays the page) a bunch of whitespace. Doesn't this add to dl time and if so, how do I get rid of it. TIA, -Matt -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2002 - 5th Anniversary!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] whitespace...
At 04:37 PM 9/4/02 , Matt Zur wrote: How do I remove the whitespace from a document? I consulted the manual and it said to use the trim function. But in a large PHP document, with lots of fuctions etc in PHP... is there a simple way to compress the whitespace of the entire document? Rather than going through each var and using the trim? Like add a header at the top: ?PHP compresswhitespace() ? If you have a 300k php document, won't the source code reveal (after the browser displays the page) a bunch of whitespace. Doesn't this add to dl time and if so, how do I get rid of it. Not 100% sure if I understand the drift of your question, but here's a few possibilities. (1) Are you concerned about whitespace you put in a PHP program to enhance readability slowing down page loads? Any whitespace WITHIN PHP tags does not get sent to the browser at all. So you don't need to worry about it. (2) Are you concerned that the OUTPUT of your PHP program and/or HTML embedded therein might have excessive whitespace? If so, you could create an output handler that cleans up the output before sending, I think; see http://www.php.net/manual/en/ref.outcontrol.php Or, use compression. See: http://www.php.net/manual/en/function.ob-gzhandler.php (3) If you simply wanted to clean up excessive whitespace in a file, you could use a snippet like: ...read file into $file variable # Replace multiple spaces/tabs with a space $file = preg_replace('/[ \t]{2,}/','/ /', $file); # Replace multiple lines with single line $file = preg_replace('/(\n|\r|\r\n){2,}/', '\r', $file); ...write $file back out That last line for replacing multiple blank lines is probably wrong; at the very least you'd have to do some platform checking (Win vs. Mac vs. Unix) to get the proper line ending. You might also be able to use the pattern '/(^$){2,}/m' In PHP4 I think you can use arrays: ...read in $file = preg_replace( array('/[ \t]{2,}/', '/(\n|\r|\r\n){2,}/'), array('/ /', '\r'), $file ); ...write out See http://www.php.net/manual/en/function.preg-replace.php http://www.php.net/manual/en/pcre.pattern.syntax.php http://www.php.net/manual/en/pcre.pattern.modifiers.php -steve ++ | Steve Edberg [EMAIL PROTECTED] | | Database/Programming/SysAdmin(530)754-9127 | | University of California, Davis http://pgfsun.ucdavis.edu/ | +-- Gort, Klaatu barada nikto! --+
RE: [PHP] Whitespace
On 23-May-01 Wade Halsey wrote: Hey How can I add a certain number of whitespace chars to a text file? I write variables to a text file and I want to seperate them by certain numbers of whitespace chars eg : $var(40 whitespace)$var2(10 whitespace) $str=sprintf('%40s%10s', $var, $var2); fwrite($fp, $str); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Whitespace
Hey How can I add a certain number of whitespace chars to a text file? I write variables to a text file and I want to seperate them by certain numbers of whitespace chars eg : $var(40 whitespace)$var2(10 whitespace) TIA Wade
Re: [PHP] Whitespace
On Wed, 23 May 2001 15:44, Wade Halsey wrote: Hey How can I add a certain number of whitespace chars to a text file? I write variables to a text file and I want to seperate them by certain numbers of whitespace chars eg : $var(40 whitespace)$var2(10 whitespace) TIA Wade /manual/en/function.str-pad.php should do the trick -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Windows: just another pane in the glass. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]