× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Rick,

A couple of points:

1) Standard XML parsers do not encode/decode Base64 encoded data.

As you are probably aware, Base64 encoding is used primarily for transferring non-text data accross networks. Basically, when you encode data as Base64 data you take three bytes (24 bits) and convert it to four bytes (32 bits), with each new byte having only the first 6 bits occupied (6 * 4 = 24 bits). The resultant data is comprised of more bytes than the original, but each byte contains a character that exists in all variants of ascii and EBCIDIC. Think about it - 6-bits only contains 64 possible values (hence Base64). If you include 26 lowercase letters, 26 uppercase letters and 10 digits - we're already up to 62! Using such a small range of universal characters makes it easy to transfer the data accross any network. This was originally devised for passing non-text data in e-mails - the ubiqutous MIME format.

The link this has with parsing XML is the basic fact that the data will be interpreted as text data by the parser, not binary data. As all parsers work with text-only data formats, encountering a non-text string would cause a fata error. Once parsing is complete you can decode the string from Base64 to the original binary format.

2) If you're getting strange values in your Base64 encoded data (such as "[" changing to "1/2" characters then there is a translation problem or a viewing problem. It may be a good idea to post the code you use to open the file, together with the CCSID of your file and the job that the open is run within. I think you should check the CCSID of your data, you're file, your open, your application, AND your interactive job/display device. I've included the last one because we work on a lot of data from Europe, encoded in a variety of CCSID values, and every week we get somebody looking at CCSID 297 data from a CCSID 285 workstation device and declaring that the data contains some wrong characters. :-)

3) Remember that parsing the Base64 encoded data into a program variable (or onto a pointer) is the first step. You need to decode it to retrieve the original binary object. The resultant text from the parsed XML should be identical to the data contained within the XML - even if you've translated the data. It's only when you decode the data that you get your binary data back. The only exceptions to this is when the data is URL encoded or Entity References are used - but you should never get a string like & in a Base64 encoded object. :-)

Cheers

Larry Ducie



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.