From: moore@cs.utk.edu (Keith Moore)
Newsgroups: comp.mail.mime,comp.mail.misc
Subject: Re: rfc822+uuencoded -> MIME filter?
Date: 24 Dec 1992 03:45:39 GMT
Organization: Univ. of Tenn. Computer Science, Knoxville
Distribution: world
Reply-To: moore@cs.utk.edu
NNTP-Posting-Host: wilma.cs.utk.edu

In article <BzpHDz.8xr@csug.cs.reading.ac.uk>, d.m.roch@reading.ac.uk (Mike Roch) writes:
> We use a mixture of mua's here; Lifeline on PC (uuencoded binaries), Eudora
> on Mac (BinHexed binaries) and Pine (MIME encoded binaries) on Unix.
> 
> Pending the release of Pine for PC and Eudora 2 (MIME compliant), we 
> occasionally need to convert an encoded binary attachment from one format 
> to another.
> 
> Has anyone written filters to accomplish this, i.e.
> 
> RFC822 header + uuencoded (or BinHexed) -> MIME
> 
> or even the converse?
> 

Here's a quick and dirty perl hack that might help.  It's fairly easy
to customize it to have it recognize new file types and emit
appropriate content-types.  No warranties, but it seems to work in
minimal testing.  It expects the input to be an rfc 822 message
(without content-type, -encoding, or mime-version), containing a
single uuencoded file, and emits a MIME message on standard output.

It's uuencoded because it has a couple of very long lines that
will probably get trashed somewhere.

(for those of you who want to know what it does without
uudecoding it -- it transliterates the uuencoded characters
into base64 characters.)

-Keith

begin 755 uu-to-mime.perl
M(R$O=7-R+VQO8V%L+V)I;B]P97)L"B,*(R!4:&ES('1A:V5S(&$@=75E;F-O
M9&5D(&UE<W-A9V4@87,@<W1A;F1A<F0@:6YP=70@86YD(&5M:71S(&$@34E-
M10HC(&)A<V4M-C0@96YC;V1E9"!M97-S86=E(&%S('-T86YD87)D(&]U='!U
M="X*(PHC($ME:71H($UO;W)E"B,*(R!"54<Z(&ET(&1O97-N)W0@;6%K92!S
M=7)E('1H870@=&AE(")E>'1R82!B:71S(B!A="!T:&4@96YD(&%R92!Z97)O
M<RP*(R!A<R!R97%U:7)E9"!B>2!T:&4@34E-12!S<&5C+@HC"B1;(#T@,3L@
M(" @(",@<V5T(&%R<F%Y(&)A<V4@=&\@,0HD+" ]("<@)SL@(" C('-E="!O
M=71P=70@9FEE;&0@<V5P87)A=&]R"B1<(#T@(EQN(CL@(",@<V5T(&]U='!U
M="!R96-O<F0@<V5P87)A=&]R"@HD<&AA<V4@/2 Q.PH*;&EN93H@=VAI;&4@
M*#P^*2!["B @("!C:&]P.R @(" C('-T<FEP(')E8V]R9"!S97!A<F%T;W(*
M(" @($!&;&0@/2!S<&QI="@G("<L("1?+" Y.3DY*3L*(" @(&EF("@O7B J
M)"\@)B8@)'!H87-E(#T](#$I('L*"21I;FAE861E<B ](# ["B @(" )<')I
M;G0@)V-O;G1E;G0M='EP93H@;75L=&EP87)T+VUI>&5D.R!B;W5N9&%R>3UX
M>7IZ>2<["@EP<FEN=" G;6EM92UV97)S:6]N.B Q+C G.PH@(" @"7!R:6YT
M("<G.PH@(" @"21P:&%S92 ](#(["B @(" );F5X="!L:6YE.PH@(" @?0H@
M(" @:68@*"]>8F5G:6X@+R F)B D(T9L9" ]/2 S("8F("1P:&%S92 ]/2 R
M*2!["B @(" )<')I;G0@)RTM>'EZ>GDG.PH))'1Y<&4@/2 G)SL*(" @( EI
M9B H)$9L9%LS72 ]?B O+BI<+EM0<%U;4W-=)"\I('L*(" @(" @(" @(" @
M)'1Y<&4@/2 G87!P;&EC871I;VXO<&]S='-C<FEP="<["B @(" )?0H@(" @
M"65L<VEF("@D1FQD6S-=(#U^("\N*EPN6T=G75M):5U;1F9=)"\I('L*(" @
M(" @(" @(" @)'1Y<&4@/2 G:6UA9V4O9VEF)SL*(" @( E]"B @(" )96QS
M:68@*"1&;&1;,UT@/7X@+RXJ7"Y;2FI=6U!P75M%95U;1V==)"\I('L*"2 @
M(" D='EP92 ]("=I;6%G92]J<&5G)SL*"7T*(" @( EE;'-I9B H)$9L9%LS
M72 ]?B O+BI<+EM*:EU;4'!=6T=G720O*2!["@D@(" @)'1Y<&4@/2 G:6UA
M9V4O:G!E9R<["@E]"@EE;'-E('L*"2 @(" D='EP92 ]('-P<FEN=&8@*")A
M<'!L:6-A=&EO;B]O8W1E="US=')E86T[(&9I;&5N86UE/5PB)7-<(B(L"@D)
M)$9L9%LS72D["@E]"B @(" @(" @<')I;G0@)V-O;G1E;G0M='EP93H@)R N
M("1T>7!E(#L*"7!R:6YT("=C;VYT96YT+71R86YS9F5R+65N8V]D:6YG.B!B
M87-E-C0G.PH)<')I;G0@)R<["@DD<&AA<V4@/2 S.PH);F5X="!L:6YE.PH@
M(" @?0H@(" @:68@*"]E;F0O("8F("0C1FQD(#T](#$@)B8@)'!H87-E(#T]
M(#,I('L*"7!R:6YT("<M+7AY>GIY+2TG.PH))'!H87-E(#T@-#L*"6YE>'0@
M;&EN93L*(" @('T*"B @("!I9B H)'!H87-E(#T](#,I('L*"2,@9FEG=7)E
M(&]U="!H;W<@;6%N>2!C:&%R86-T97)S('-H;W5L9"!B92!I;B!T:&4@;&EN
M90H)(R!F:7)S="!C:&%R(&AA<R!E;F-O9&5D(&QE;F=T:"!O9B!T:&4@(R!O
M9B!C:&%R86-T97)S("AB969O<F4*"2,@96YC;V1I;F<I('1H97)E(&%R92!I
M;B!T:&4@;&EN92X*"21I;FQE;B ]("@H=6YP86-K*")C(BP@<W5B<W1R("@D
M7RP@,2P@,2DI("T@,'@R,"D@)B P>#-F*3L*"6EF("@D:6YL96X@/3T@,"D@
M>PH)(" @(&YE>'0@;&EN92 ["@E]"@DD;W5T;&5N(#T@:6YT("@H)&EN;&5N
M("L@,BD@+R S*2 J(#0["@DC('!A9"!L:6YE('1O('1H92!R:6=H=" C(&]F
M('-P86-E<R!I;B!C87-E(&ET)W,@9V]T=&5N('1R=6YC871E9 H)(R!I;B!S
M:&EP;65N="X@9&ES8V%R9"!L96YG=&@@8VAA<F%C=&5R('=H:6QE('=E)W)E
M(&%T(&ET+@H))'@@/2!S=6)S='(H)%\@+B B(" @(" @(" @(" @(" @(" B
M+" R+" D;W5T;&5N*3L*"2,@9&5L971E(&%N>2!C:&%R86-T97)S(&YO="!I
M;B!U=65N8V]D92=S('-E= H))'@@/7X@='(O(& A(B,D)28G*"DJ*RPM+EPO
M,#$R,S0U-C<X.3H[/#T^/T!!0D-$149'2$E*2TQ-3D]045)35%565UA96EM<
M75Y?+R]C9" ["@DC('1R86YS;&ET97)A=&4@=&\@8F%S938T+@H)(R!S;VUE
M('5U96YC;V1E)W,@=7-E(%-004-%(&9O<B!Z97)O+"!O=&AE<G,@8F%C:W%U
M;W1E+"!S;PH)(R!T<F%N<VQA=&4@8F]T:"X*"21X(#U^('1R+R!@(2(C)"4F
M)R@I*BLL+2Y<+S Q,C,T-38W.#DZ.SP]/C] 04)#1$5&1TA)2DM,34Y/4%%2
M4U155E=865I;7%U>7R]!04)#1$5&1TA)2DM,34Y/4%%24U155E=865IA8F-D
M969G:&EJ:VQM;F]P<7)S='5V=WAY>C Q,C,T-38W.#DK7"\O9" ["@DD>" ]
M?B!T<B\@+T$O9" ["@EI9B H*"1I;FQE;B E(#,I(#T](#(I('L*"2 @(" D
M>" ]?B!S+RXD+STO.PH)?0H)96QS:68@*"@D:6YL96X@)2 S*2 ]/2 Q*2![
M"@D@(" @)'@@/7X@<R\N+B0O/3TO.PH)?0H)<')I;G0@)'@["B @("!]"B @
K("!E;'-E('L*"7!R:6YT("1?.PH@(" @?0H@(" @;F5X="!L:6YE.PI]"B @
 
end



--
Keith Moore / U.Tenn CS Dept / 107 Ayres Hall / Knoxville TN  37996-1301
Internet: moore@cs.utk.edu      BITNET: moore@utkvx
Newsgroups: comp.mail.mime