Re: decoding MIME:Base64 question?
From: Wiggins D Anconia (wiggins_at_danconia.org)
Date: 01/13/04
- Previous message: Drieux: "Re: Oreilly's "Learning Perl 3rd Edition""
- Maybe in reply to: Tino Arellano: "decoding MIME:Base64 question?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 13 Jan 2004 12:31:01 -0700 To: "Tino Arellano" <nurbs@linuxmail.org>, beginners@perl.org
>
> Hello folks,
>
> If I encode a file with MIME::Base64 with the following script,
encode_base64.pl. The question is; how do I decode
> the file? I use the following script, decode_base64.pl to decode back
to the original source but that did not work because
> they are different from each other.
>
> Thank you...
>
Naturally you should use strict and warnings...
To get your code snippets to work for me I needed to 'binmode' the read
handle in the first script, 'binmode' the output handle in the second,
and read a line at a time rather than chunks in the second. The binmode
may be system or file dependent I am not clear about this. In the case
of the base64 encoded data there is no need to read it chunked like that
I suspect the newlines are being included in $buf which is being base64
decoded and included as data rather than being removed as they would
when the record separator is allowed to do its thing, though this isn't
clear to me either since it should drop them or skip them or something
since newlines aren't in the base64 character set. You might try
enabling the diagnostic messages and see what they provide...
<snip code>
perldoc -f binmode
- Previous message: Drieux: "Re: Oreilly's "Learning Perl 3rd Edition""
- Maybe in reply to: Tino Arellano: "decoding MIME:Base64 question?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|