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

Re: Help with Base64 Encoding



Hi Vicki,

Forgive me, but I don't know what set_etoa, set_atoe, and do_iconv are. 
  It's easy enough to guess what they might be used for, but I'm not 
sure how to tell you what's wrong with them when I know nothing about 
them...?

I'll tell you this, however:  The base64 encoding is designed to prevent 
translation errors.  Once data is encoded as base64, it shouldn't matter 
how the (encoded)data gets translated.  You should be able to translate 
to any code page, and back again, and it should not change the encoded 
data.  Once the base64 is decoded, it should always result in the exact 
same binary values that were fed into the encoder.

Most mistakes I see with base64 are a result of people not understanding 
this.  They think they can feed EBCDIC data into an encoder, and the 
decoder will output ASCII data.  Nope.  The output from the decoder will 
be exactly the same, at the binary level, as the input.  Therefore, if 
your input was EBCDIC text, the output will have the same binary values 
as EBCDIC text (and therefore won't work as ASCII text!)   Likewise, if 
your input is picture data, sound data, an executable program, or any 
other binary data, the output should be exactly the same.

So...  based on that, and your symptoms, I see 4 possible issues:

1) Your input to the encoder is wrong to begin with.  (It doesn't 
contain the exact bits that the printer is looking for.)

2) Your encoder is broken.

3) Your decoder is broken.

4) Something is translated the data after it has been decoded and before 
it's fed into the printer.


Unfortunately, I just don't know enough about the process to help you 
further.



On 1/31/2011 12:06 PM, Vicki Seaberg wrote:
>
>     Hello All,
>
>
>     I'd really appreciate any help with this project as I'm definitely
>     struggling to find a solution.  In short, my Base64 encoded ZPL string
>     is printing with a few invalid characters.  I think there is some
>     character conversion problem but I have no idea where to begin
>     looking.
>
>
>     I'm using http_url_post_xml to "Create a Shipment" using our shipping
>     company software.  It passes back shipment data fields-one of which is
>     a Base64 encoded binary ZPL string containing the data for our
>     shipping label.  I embed this base64 encoded ZPL string in a text
>     field along with some other data.  I'm using Scott's HTTPAPI socket
>     application to "write" it to a windows software application that
>     decodes the ZPL portion of the data and sends the string to our
>     automated Zebra print/apply label applicator.  (Part of the HTTPAPI
>     code executes the "set_etoa" and "do_iconv" subroutines.)
>
>
>     This entire process works great for all shipping services in which the
>     ZPL string is NOT base64 encoded.  For the one service that uses the
>     encoding, there are a few character that appear as "?" instead of
>     dashes.  The 2D Matrix barcode also has some invalid data in it.
>
>
>     I hope I've provided enough information to understand my situation.
>     Can anyone help in figuring out what is wrong?  All help is very much
>     appreciated!!
>
>
>
>
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------