为什么自带的函数ENCODE和DECODE出来就有问题?
在做SOAP的时候,发现上传到服务端程序就会有问题,而且都是delphi开发的,编码也是用的自带函数SOAP.endecd,于是在单机上进行测试,代码如下:
var input_str_stream:TStringStream; input_mem_stream:TMemoryStream; output_str_stream:TStringStream; output_mem_stream:TMemoryStream; output_file,send_string:string;begin try input_mem_stream:=TMemoryStream.Create; output_mem_stream:=TMemoryStream.Create; input_mem_stream.LoadFromFile(edt1.Text); input_mem_stream.SaveToFile('d:\temp_64_oldoutput.jpg'); input_str_stream:=TStringStream.Create; input_mem_stream.SaveToStream(input_str_stream); send_string:=EncodeBase64(input_str_stream,Length(input_str_stream.DataString));//编码 output_str_stream:=TStringStream.Create(DecodeBase64(send_string)); output_mem_stream.LoadFromStream(output_str_stream); output_file:='D:\tmp_64_output.jpg'; output_mem_stream.SaveToFile(output_file); finally input_str_stream.Free; input_mem_stream.Free; output_str_stream.Free; output_mem_stream.Free; end;