[U2] Decoding 64Base string
I am looking for information on decoding a base64 string. We will be receiving this back with an xml stream from a client. The base64 string is a image which we must decode and write out. Anyone having done this? Would love to talk to you about it or possibly get snippets to get us on our way. I have searched the u2ug site but found nothing thanks .. -- DSig David Tod Sigafoos --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Decoding 64Base string
Universe has the ENCODE function. When I tried using it last, it seemed to encode my data into base64 just fine, but decoding always gave me an empty string. Eventually, I just wrote my own encoding/decoding functions from documentation off the www. rex --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Decoding 64Base string {Unclassified}
If you're on UniVerse and on release 10.x (UD 6.x may have the same functionality, check the IBM reference manuals, for UV it's in the Basic Extensions manual) then you should be able to use the ENCODE() function. Your code might look a bit like this: E.DLOC = '1' ; * data passed directly E.RLOC = '1' ; * result in a string E.ALG= 'Base64' E.DATA = '' E.RESULT = '' * Note that E.DATA needs to be delimited by a CHAR(10) at the end for some reason E.DATA = My.Base64.Encoded.string:CHAR(10) E.RESULT = '' E.ACTION = '2' ; * Base64 decode E.STATUS = ENCODE(E.ALG, E.ACTION, E.DATA, E.DLOC, E.RESULT, E.RLOC) IF E.STATUS EQ '0' THEN CRT ' Plain Text ':QUOTE(E.RESULT) END ELSE GOSUB DISPLAY.ENCODE.STATUS END HTH Mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Tod Sigafoos Sent: Tuesday, 19 April 2005 05:32 To: u2-users@listserver.u2ug.org Subject: [U2] Decoding 64Base string I am looking for information on decoding a base64 string. We will be receiving this back with an xml stream from a client. The base64 string is a image which we must decode and write out. Anyone having done this? Would love to talk to you about it or possibly get snippets to get us on our way. I have searched the u2ug site but found nothing thanks .. -- DSig David Tod Sigafoos --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ The information contained in this Internet Email message is intended for the addressee only and may contain privileged information, but not necessarily the official views or opinions of the New Zealand Defence Force. If you are not the intended recipient you must not use, disclose, copy or distribute this message or the information in it. If you have received this message in error, please Email or telephone the sender immediately. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] Decoding 64Base string
David, I am looking for information on decoding a base64 string. We will be receiving this back with an xml stream from a client. The base64 string is a image which we must decode and write out. what version of U2 are you on? What O/S? UV 10.0 and later allows you to call ALG = Base64 ACTION = 2 ;* 1 = Encode, 2 = Decode INLOC = 1 ;* 1 = Data in string, 2 = Data in file (B64DATA should hold path to file) OUTLOC = 1 ;* 1 = Data in string, 2 = Data in file (RESULT should hold path to file) RETURNCODE = DECODE(ALG, ACTION, B64DATA, INLOC, RESULT, OUTLOC) IF RETURNCODE NE 0 THEN PRINT DECODING FAILED :RETURNCODE * 1 - Unsupported Algorithm * 2 - Invalid Parameters * 3 - Data cannot be read * 4 - data cannot be encoded/decoded END - You could also find a uudecode utility for your O/S. Write the data to a type 19 (DIR) file and execute the command to decode it. - Lastly you could read RFC3548 and roll your own converter. As a hint, BYTEVAL(STR, POS) is much faster than SEQ(STR[POS,1]) under UV. HTH, Craig --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/