本文介绍了Mime/Base 64编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一种在Delphi 7和PHP中将字符串编码为Mime/Base64的方法
I need a way to encode a string to Mime/Base64 in Delphi 7 and PHP
这两个编码器必须兼容:)
These two encoders must be compatible :)
推荐答案
从Delphi 6开始就包含了EncdDecd单元.下面是它包含的与Mime兼容的base64函数.
The unit EncdDecd has been included since Delphi 6; below are the Mime compatible base64 functions it contains.
此来自FlexVN的缓存的帖子(原始帖子并不总是在线的)介绍了如何使用EncdDecd单元在PHP和Delphi之间进行base64操作.
This cached post from FlexVN (the original post is not always on-line) 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;
这篇关于Mime/Base 64编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!