[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to verify a BASE64 encoded file
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.
On 10/1/2010 10:35 AM, Mike Evans wrote:
> Could this be an ASCII vs EBCDIC issue I'm having? The XML I'm trying to
> encode is coming from the IFS with a codepage of 819. But if it
> translates it to EBCDIC before running through the BASE64 routine then
> that won't work.
>
> On Fri, 2010-10-01 at 09:21 -0500, Mike Evans wrote:
>> OK this is not strictly HTTPAPI related but close.
>>
>> The web service I'm trying to use needs a BASE64 encoded file passed
>> along. (Thanks Scott for helping get that figured out) I'm getting the
>> dreaded 500 error message but buried in the debug info is a more
>> useful(?) error number, although it maybe unique to the server I'm
>> trying to connect to. Does an error number: 1185259520 mean anything to
>> anyone?
>>
>> Also is there a way I can decode this file on a pc to make sure it
>> decodes properly there?
>>
>> Mike
>>
>> -----------------------------------------------------------------------
>> 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
> -----------------------------------------------------------------------
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------