Code is very simple, if it is in this online website
http://bbs.tc711.com/tc711/tool/base64_gb2312.php
Come out as a result of the "province", "guangdong province"
But I use the above code performs the result is shown in figure in XE5
At superior to reassure
CodePudding user response:
I have enclosed the two functions, base64 encryption and decryption"Province", "guangdong province", "normal base64 code should be the following values:
InByb3ZpbmNlIjoi5bm/5 lic55ybig==
The class function TSMEncrypt. Base64Encode (const input: string; Encoding: TEncoding) : string;
Var
InStr, OutStr: TStringStream;
The begin
InStr:=TStringStream. Create (Input, Encoding);
Try
OutStr:=TStringStream. Create (");
Try
EncodeStream (InStr, OutStr);
The Result: OutStr=. DataString;
The finally
OutStr. Free;
end;
The finally
InStr. Free;
end;
end;
The class function TSMEncrypt. Base64Decode (const input: string; Encoding: TEncoding) : string;
Var
InStr, OutStr: TStringStream;
The begin
InStr:=TStringStream. Create (Input);
Try
OutStr:=TStringStream. Create (' ', Encoding);
Try
DecodeStream (InStr, OutStr);
The Result: OutStr=. DataString;
The finally
OutStr. Free;
end;
The finally
InStr. Free;
end;
end;