Fix for Outlook quoting (was Re: AARRRRGH!!! (was RE: Linux Install error)

Jeff Kinz jkinz at kinz.org
Fri Dec 19 12:21:02 EST 2003


On Fri, Dec 19, 2003 at 10:30:58AM -0500, Kevin D. Clark wrote:
> Of course, these solutions depend on the benevolence of the people who
> actually use these mailers.
				:-)
> 
> OTOH, a while ago I wrote a quick hack that I use to transform
> Outlook's broken quoting style into something reasonable.  This is
> attached.  I use this program when I have to jump into a thread [1]
> that is already being conducted using this broken quoting style.  I
> hope that other people find it to be useful as well.
......

> # 0.2 - renamed original identifiers to be less offensive
> Regards,
     :-)

Nice script Kevin.  I especially enjoyed reading the less offensive
variable names. :-)   

Really though - I liked it.  Do you mind if I re-distribute to
anyone who wants it ?  Do you have a license in mind?
(BSD or GPL ?)


> 
> --kevin
> 
> [1]  Most versions of Outlook don't seem to handle threading either,
>      which in a twisted sort of way, seems to justify this broken
>      quoting style.
> 
> -- 
> Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
> cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
> alumni.unh.edu!kdc
> 
> 
> 
> 
> #!/usr/bin/perl
> 
> # fix-outlook-quoting.pl
> 
> # Author:  Kevin D. Clark (alumni.unh.edu!kdc)
> 
> 
> # This program will take a region of text that looks like this....:
> 
> # > Kevin ,
> # >
> # > Blah blah blah blah blah bla.
> # >
> # > Ralph
> # > 
> # > 		 -----Original Message-----
> # > 		From: 	Clark, Kevin
> # > 		Sent:	Thursday, January 03, 2002 8:18 AM
> # > 		To:	A bunch of people
> # > 		Cc:	A bunch of other people
> # > 		Subject: life, the universe, and everything
> # > 
> # > 		Ralph,
> # > 
> # >     Mumble mumble mumble mumble.
> # > 
> # > 		Kevin
> 
> # (you'd end up with such a region of text if your mail program quoted 
> #  email in the cannonical way, and you had to deal with brain-dead
> #  email clients like Outlook)
> 
> # ....and transforms this into this:
> 
> # > Clark, Kevin writes:
> # > > Ralph,
> # > > 
> # > > Mumble mumble mumble mumble.
> # > > 
> # > > Kevin
> # 
> # > Kevin ,
> # >
> # > Blah blah blah blah blah bla.
> # >
> # > Ralph
> # > 
> # `
> 
> 
> # this program is also general enough to handle a whole thread of the 
> # braindead outlook quoting style.  After this transmogification is performed,
> # it's simple enough to edit the resulting text to actually look decent.
> 
> 
> # If you use emacs as your editor and you've yanked the mangled message into
> # your reply buffer, some variant of:
> #
> #   C-u M-| fix-outlook-quoting.pl
> #
> # will suffice.
> 
> # If you use vi as your editor, some variant of:
> #
> # ma  (move to end of mangled text)
> # :'a,.!fix-outlook-quoting.pl
> #
> # might work.
> 
> 
> 
> # Version history:
> #
> # 0.1 - initial version
> # 0.2 - renamed original identifiers to be less offensive
> 
> 
> undef $/;
> 
> $_ = <>;
> 
> ($firstPart, $screwed) = /(.*?)(>\s*---*Original Message---*.*)/s;
> 
> # print ":$firstPart:\n";
> 
> $screwed =~ s/^[> \t]*//mg;
> 
> @screwedList = split(/---*Original Message---*/, $screwed);
> 
> # the first item in the list is screwed, er, I mean, blank...
> shift @screwedList;
> 
> 
> $i = 1;
> for $f (@screwedList) {
> 
>   ($from) = $f =~ /From:\s+(.*?)\s*$/m;
> 
>   print "> " x $i++;
>   print "$from writes:\n";
> }
> 
> $i = scalar(@screwedList) + 1;
> for $f (reverse(@screwedList)) {
> 
>   # delete first "paragraph" of screwed "headers"
>   $f =~ s/.*?\n\s*\n//s;
> 
>   # quote properly
>   $quotes = "> " x $i--;
> 
>   $f =~ s/^/${quotes}/mg;
> 
>   print "$f\n";
> }
> 
> print "$firstPart\n";
> 
> 
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://www.blu.org/mailman/listinfo/discuss
> 

-- 
Jeff Kinz, Open-PC, Emergent Research,  Hudson, MA.  
"jkinz at kinz.org" is copyright 2003.  
Use is restricted. Any use is an acceptance of the offer at
http://www.kinz.org/policy.html.



More information about the Discuss mailing list