[Wylug-help] Email line wrapping question

Geoff Richards qef at ungwe.org
Thu, 10 Apr 2003 12:33:51 -0400


On Thu, Apr 10, 2003 at 12:31:11PM -0400, Geoff Richards wrote:
>
> In the spirit of "it compiles, so ship it", here is a crufty Perl
> program I wrote yesterday to decode some QP.  It is known to work
> on at least one message :-)  But I didn't refer to the RFC, so it
> is probably wrong.
> ...

> [ Content of type application/x-perl deleted ]

Bugger.



#!/usr/bin/perl -w
use strict;

# Filter quoted-printable encoded text to unencoded text.  By qef.
# Note: uses LF for line endings, not CRLF as RFC 822 says.

while (<>) {
   s/\s+\z//;                    # Trailing whitespace must be encoded.
   $_ .= "\n" unless s/=$//;     # /=$/ means a soft line-break.

   s/=([0-9A-Z]{2})/chr hex $1/eig;

   print;
}

# vi:ts=3 sw=3 expandtab: