[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to verify a BASE64 encoded file



Scott,

Here's the code. Real straight forward. The XML document was created
with CGIDEV2 in a previous pgm. Stored on the IFS with codepage 819. I
read it in, encode it, and add it to a usrspc. The beginning of the
usrspc has the SOAP header info. After the encoded file is added I put
the SOAP trailer stuff.

       flags = O_RDONLY+O_TEXTDATA;
       fd = open('/mwe/uttax.xml':flags);
       if fd < 0;
          Msg = 'open(): failed for reading';
          dsply Msg;
          *inlr = *on;
          return;
       endif;
       len = read(fd: %addr(rddata):%size(rddata));
       Dow       len >= 1;
         EncodedLen=base64_encode(%addr(rddata):%len(rddata):
                                  pData:%len(RdData2));
         pData=pData+EncodedLen;
         TotalLen+=EncodedLen;
         len = read(fd: %addr(rddata):%size(rddata));
       ENDDO;

       callp close(fd);

On Fri, 2010-10-01 at 14:45 -0500, Scott Klement wrote:
> Hi Mike,
> 
> > Sounds familiar. I learned to deal with UU encoded files back in the
> > early '90s.
> 
> Yep..  Base64 and uuencoding are very, very similar.  Base64 is just an 
> improved version (the characters it uses are all invariant, whereas 
> uuencode used some variant characters, and that caused problems for 
> internationalization.)
> 
> 
> > So... I guess the question is. When I read in an XML file I created on
> > the IFS with code page 819 and I BASE64 encode what I just read in, does
> > it read it in translating ASCII to EBCDIC so when I encode it>, I'm
> > encoding EBCDIC? How would I get it to NOT do the ASCII ->  EBCDIC
> > translation? Would it still do the encoding correctly?
> >
> 
> I know nothing about how you're reading the file or encoding it...?  Can 
> you provide more details?  Maybe post the code you're using to read the 
> file?   Or is this a 3rd party utility you're using?
> 
> (My own base64 tool doesn't know how to read a file -- so you must not 
> be using that, unless you wrote the file-reading code on your own?!)
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------