|
Larry, CCSID of input XML - 1252 Here are the relative sections of code. If I miss something let me know. XML open: XMLDesc = ifsOpen(%TrimR(InPath) :TxtRd); PDF output file open: PDFDesc = ifsOpen(%TrimR(OutPath) :TxtWrt + ', codepage=1252'); // old = 850 // Close and reopen the file. This is required to perform translation // from our current job CCSID into the ascii codepage. THIS IS REQUIRED! RtnCd = ifsClose(PDFDesc); PDFDesc = ifsOpen(%TrimR(OutPath) :TxtWrt); Base64 decoding (archived code from Beppe Costagliola): p DecBase64 b Export d DecBase64 pi d InStr@ * Value d InStrLen 10u 0 Const d OutStr@ * Value d Input s 4a Based(InStr@) d Output s 3a Based(OutStr@) // Set of characters worked on as a group. Equates to 3 decoded characters d ChrGrp s 10i 0 Dim(4) // Equivalent of C placing character value into an integer field d Char ds d ChrInt 3u 0 d ChrAlpha 1a Overlay(ChrInt) // Offsets to the input and output strings d iPos s 10i 0 d oPos s 10i 0 // Miscellaneous variables d Ctr s 10u 0 Inz(1) d Iterations s 10u 0 /Free // Reduce length to number of iterations Iterations = InStrLen / 4; // Decode input string DoW Ctr <= Iterations; iPos = 1; oPos = 1; // Convert characters to Base64 integers ChrGrp(1) = MimeDecode(%subst(Input: iPos: 1)); ChrGrp(2) = MimeDecode(%subst(Input: iPos + 1: 1)); ChrGrp(3) = MimeDecode(%subst(Input: iPos + 2: 1)); ChrGrp(4) = MimeDecode(%subst(Input: iPos + 3: 1)); // Decode integer values to get original character values and place // into output string ChrInt = %bitand ((ChrGrp(1) * 4 + %Int(ChrGrp(2) / 16)):255); %subst(Output: oPos: 1) = ChrAlpha; ChrInt = %bitand ((ChrGrp(2) * 16 + %Int(ChrGrp(3) / 4)):255); %subst(Output: oPos + 1: 1) = ChrAlpha; ChrInt = %bitand ((ChrGrp(3) * 64 + ChrGrp(4)):255); %subst(Output: oPos + 2: 1) = ChrAlpha; // Move to next section of the strings InStr@ += 4; OutStr@ += 3; // Increment counter Ctr += 1; EndDo; // Terminate the output string Output = x'00'; /End-Free p DecBase64 e //------------------------------------------------------------------------- // MimeDecode - Convert character to decimal representation //------------------------------------------------------------------------- p MimeDecode b d MimeDecode pi 10i 0 d CharIn 1a Const // Characters represented in Base64 character set d tbBase64 s 65A Inz('ABCDEFGHIJKLMNOPQRSTUVWXYZ- d abcdefghijklmnopqrstuvwxyz- d 0123456789+/=') /free return %scan(CharIn: tbBase64) - 1; /end-free p MimeDecode e Rick Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain legally privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.