[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Base64 problem
Hello,
I'm consuming with HTTPAPI a web service that sends back base64 encoded
data.
Everything is ok until I try to decode the base64 data.
So I went to this url :
http://www.opinionatedgeek.com/dotnet/tools/Base64Encode/Default.aspx
I type the text below: TestFranck
I get the encoded base64 data : VGVzdEZyYW5jaw==
And I made 2 little pgms ( JA005 & JA006 ) to reproduce the same with
the base64 encode and decode provided by Scott.
But it doesn't work.
I can't see what I'm doing wrong ? Any help would be appreciate ...
Thanks
H/COPY QCPYSRC,STD_H
H BNDDIR('BASE64')
//---------------------------------------------------------------
// JA006 - Test Base64
//---------------------------------------------------------------
// Encodage Base64
//---------------------------------------------------------------
//---------------------------------------------------------------
// définitions des prototypes
//---------------------------------------------------------------
/copy qcpysrc,BASE64_H
//---------------------------------------------------------------
// définitions des variables
//---------------------------------------------------------------
D base64 s 32767a
D base64Dec s 32767a
/free
base64Dec = 'TestFranck';
base64_encode(
%addr(base64Dec):
%scan(' ': base64Dec: 1)-1:
%addr(base64):
%size(base64)
);
*inlr=*on;
/end-free
//---------------------------------------------------------------
// JA005 - Test Base64
//---------------------------------------------------------------
// Décodage Base64
//---------------------------------------------------------------
//---------------------------------------------------------------
// définitions des prototypes
//---------------------------------------------------------------
/copy qcpysrc,BASE64_H
//---------------------------------------------------------------
// définitions des variables
//---------------------------------------------------------------
D base64 s 32767a
D base64Dec s 32767a
D len1 s 10i 0
/free
base64 = 'VGVzdEZyYW5jaw==';
base64_decode(
%addr(base64):
%scan(' ': base64: 1)-1:
%addr(base64Dec):
%size(base64Dec)
);
*inlr=*on;
/end-free
begin:vcard
fn:Franck Peter
n:Peter;Franck
org:SDV LI;Informatique
email;internet:mrs.infosys@xxxxxxx
tel;work:04.42.02.44.66
tel;fax:04.42.89.42.89
version:2.1
end:vcard
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------