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

Re: How to verify a BASE64 encoded file

Hi Scott,

Sounds familiar. I learned to deal with UU encoded files back in the
early '90s. 

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?

On Fri, 2010-10-01 at 11:47 -0500, Scott Klement wrote:
> Hi Mike,
> The purpose behind base64 is to guarantee the same exact binary value of 
> a file when it's sent in a text-only document.  So data that has already 
> been base64 encoded can be translated from any given character set to 
> any other given character set, and when it's decoded, it'll have the 
> exact same binary value.  Likewise, it can be sent in a text-only 
> medium, such as E-mail, Usenet, XML, etc.  Even if the data (before 
> encoding) isn't text-only, it'll work through those mediums...  for 
> example, a program, picture, sound-file, etc... these files don't 
> contain human-readable letters and numbers -- the values of the bytes 
> have a particular meaning.  For example, in a picture, the byte may 
> represent the color of a dot to be printed on the screen.  In a sound 
> file, the byte may represent the pitch/tone of a given sound, etc.  Even 
> though they aren't human-readable text, they can be sent through a 
> text-only medium like e-mail or XML after they are Base64 encoded. That 
> e-mail could subsequently be translated from ASCII/EBCDIC without 
> affecting the encoded content.  When decoded, the picture would look the 
> same, or the sound file would sound the same.
> Could your problem be an ASCII vs EBCDIC issue?   Very probably if 
> you're sending a text document.  If you are taking text that's in EBCDIC 
> and base64 encoding it -- the decoded value will have the exact same 
> binary value.  Always.  That's the point of base64.
> So... if you're base64 encoding it from EBCDIC data...  then it'll 
> decode to EBCDIC data.  Even if the receiver is on an ASCII system.
> The solution, of course, is to convert it to ASCII (or Unicode or 
> whatever is appropriate) prior to encoding it.

This is the FTPAPI mailing list.  To unsubscribe, please go to: