| Base64Encoding function is frequently used in MIME Type based programming. Here's the good resource for supporting base64encode and base64decode.
uses IdCoder, IdCoder3to4, IdCoderMIME, jpeg;
function base64Decode(const Text : ansiString): ansiString;
var
Decoder : TIdDecoderMime;
begin
Decoder := TIdDecoderMime.Create(nil);
try
Result := Decoder.DecodeString(Text);
finally
FreeAndNil(Decoder)
end
end;
function base64encode(const Text : ansiString): ansiString;
var
Encoder : TIdEncoderMime;
begin
Encoder := TIdEncoderMime.Create(nil);
try
Result := Encoder.EncodeString(Text);
finally
FreeAndNil(Encoder);
end
end;
I verified above functions on Delphi 2009. |