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

Re: Base64 Decoding



Hi Michael,

You need to *include* the == at the end.  And make sure any other 
whitespace in the XML tag has been removed (blanks, CRLF, tabs, etc)

The = or == is needed (if it was provided.)  Don't strip it.


On 7/12/2010 1:07 PM, Michael Ryan wrote:
>
>     Hi Scott -
>     Thanks for the quick reply. I'm indeed using your base64 decoding
>     routine. So if I have the following in an XML element that I've
>     translated to EBCDIC:
>     MYCOMPANY_ENCODING="MIME-64">JVBERi0xLjeLjz9MNCjkg...==
>     I want to grab everything from ">JVBER..." up to (but not including)
>     the ending "==", right? Then I would use base64_decode to decode the
>     contents back into binary. It's supposed to be a PDF file, but it
>     doesn't look like enough data to me. Anyway, I would then have to get
>     that PDF data to a printer. But first I need to decode it...:) Thanks!
>
>     On Mon, Jul 12, 2010 at 1:28 PM, Scott Klement
>     <[1]sk@xxxxxxxxxxxxxxxx>  wrote:
>
>       Hi Michael,
>       If you're using _my_ base64 decoding routine, then the input needs
>       to be
>       in EBCDIC.  It's written in RPG, and will see ASCII as nothing but
>       gibberish.
>       Also, the decoder only understands base64 encoded data.  It doesn't
>       understand XML, CRLF, blanks, or anything else besides base64
>       encoded
>       data.  It's up to you to extract the base64 encoded data and pass
>       it to
>       the decoder.
>       Good luck
>
>     On 7/12/2010 12:01 PM, Michael Ryan wrote:
>     >
>     >      Here's my scenario. I'm getting a PDF file in an XML stream. The
>     PDF
>     >      file is an an element, and starts with blah_ENCODING="MIME-64".
>     I'm
>     >      attempting to use Base64 decoding, but I'm running into
>     problems. I've
>     >      d/l'ed the Base64 code, created the service program, all looks
>     well
>     >      there. I've searched the archives for an example, and am using a
>     >      simple one. The decode fails on a "can't convert the first
>     character"
>     >      error. I'm flailing a bit, so I thought I'd ask for a hand.
>     Should I
>     >      be using the ASCII (UTF-8?) value of the element? Any way I can
>     debug
>     >      this further (ala httpapi debug file)? Thanks!
>     >
>     >
>     >
>     >
>
>       >
>       -------------------------------------------------------------------
>       ----
>       >  This is the FTPAPI mailing list.  To unsubscribe, please go to:
>       >  [2]http://www.scottklement.com/mailman/listinfo/ftpapi
>       >
>       -------------------------------------------------------------------
>       ----
>       -------------------------------------------------------------------
>       ----
>       This is the FTPAPI mailing list.  To unsubscribe, please go to:
>       [3]http://www.scottklement.com/mailman/listinfo/ftpapi
>       -------------------------------------------------------------------
>       ----
>
> References
>
>     1. mailto:sk@xxxxxxxxxxxxxxxx
>     2. http://www.scottklement.com/mailman/listinfo/ftpapi
>     3. 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
> -----------------------------------------------------------------------

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