views:

88

answers:

2

hi !

I need a way to encode a string to Mime/Base64 in Delphi 7 and PHP

These two encoders must be compatible :)

thanks in advance :)

+2  A: 

Hi Plastkort,

the Indy-Project provides base64 encoder/decoder classes. You can find the documentation here.

For PHP you can use the PHP-internal functions base64_encode base64_decode.

Cheers,
haggi

haggi
+1  A: 

The unit EncdDecd has been included since Delphi 6; below are the Mime compatible base64 functions it contains.

This cached post from FlexVN explains how to do the base64 thing between PHP and Delphi using the EncdDecd unit.

unit EncdDecd;

interface

uses Classes, SysUtils;

procedure EncodeStream(Input, Output: TStream);
procedure DecodeStream(Input, Output: TStream);
function  EncodeString(const Input: string): string;
function  DecodeString(const Input: string): string;

function  DecodeBase64(const Input: AnsiString): TBytes;
function  EncodeBase64(const Input: Pointer; Size: Integer): AnsiString;

--jeroen

Jeroen Pluimers