SUMMARY: Base64 encoding

From: Jean-Francois Vibert <vibert_at_b3e.jussieu.fr>
Date: Thu, 21 Nov 1996 19:19:28 +0100

My question was:

> Dear gurus,
>
> Rather often, we get attached documents in Netscape mail, For example,
> one of the last message on this list was attached with the
> following characteristics:
>
> Name: lpr_osf32
> Type: unspecified type (application/octet-stream)
> Encoding: base64
>
> Evidently, saving it gives an encoded document, unreadable.
> Since this was sent to the list devoted to DU, I suppose that a tool
> exists to decode and read it. What tool? Where can I found it?

Evidently I obtained answer in the minutes...Thank you very much to all
that responded:
Hellebo Knut
Matti Saarinen
Ron Lee
Jon Craig
Yizhong Zhou
Masson Christophe
Stephen B. Henry
Oisin McGuinness
Kevin Oberman
Ollivier Robert
Anthony Talltree

The answers are:

 This is a MIME encoded mail. You need some MIME tools and/or a MIME
mailer to deal with it.

Use a MIME compliant mail (such as ELm-ME+ or Mutt or pine or metamail)
            ftp://ftp.ibp.fr/pub/unix/mail/mutt/
            ftp://ftp.ibp.fr/pub/unix/mail/elm-me/
        ftp://ftp.cac.washington.edu/pub/pine/pine3.95.tar.gz
        ftp://thumper.bellcore.com/pub/nsb/mm2.7.tar.Z
        ftp://ftp.funet.fi/pub/unix/mail/metamail/

or get mpack:
        ftp://ftp.andrew.cmu.edu:/pub/mpack

or use Netscape:
(In fact I use Netscape, but the configuration was bad. Now it works.
Your answers led me to look at my Netscape config that was modified.
Thanj you :-) ).
 
or even use a perl script:

#!/usr/local/bin/perl
# BASE64 converter
_at_a=_at_ARGV;
die "$0 [-u] <in >out\n" if $#a > -1 && ($a[0] ne '-u' || $#a > 0);
$/=0;
$_=<STDIN>;
if ($a[0] =~ /u/)
{
    s/[\s=]*//g;
    tr|A-Za-z0-9\+/|\0-\77|;
    $_=unpack('B*', $_);
    s/00(......)/$1/g;
    $l=length;
    $_=substr($_, 0, $l & ~7) if $l & 7;
    $_=pack('B*', $_);
    print;
}
else
{
    $_=unpack('B*', $_);
    s/(......)/00$1/g;
    $l=length;
    if ($l & 7)
    {
        $e = substr($_, $l & ~7);
        $_ = substr($_, 0, $l & ~7);
        $_ .= "00$e" . '0' x (6 - length $e);
    }
    $_=pack('B*', $_);
    tr|\0-\77|A-Za-z0-9\+/|;
    while ($i<length)
    {
        print substr($_, $i, 75), "\n";
        $i += 75;
    }
}


-- 
Dr Jean-Francois Vibert; B3E ESI INSERM U444
Faculte de Medecine Saint-Antoine, 27 rue Chaligny. 75571 PARIS Cedex 12
Tel: (33)-1-44.73.84.31; Fax: (33)-1-44.73.84.54
e-mail Internet: vibert_at_b3e.jussieu.fr        http://www.b3e.jussieu.fr
Received on Thu Nov 21 1996 - 19:57:20 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:47 NZDT