Added parameter to inform string encoding.

This commit is contained in:
João Antônio Duarte 2019-07-02 15:43:37 -03:00
parent 4b41c65721
commit 15aa842bf2

View File

@ -513,7 +513,7 @@ function B64Encode(const aValue: string): string; overload;
function B64Encode(const aValue: TBytes): string; overload; function B64Encode(const aValue: TBytes): string; overload;
function B64Decode(const aValue: string): string; function B64Decode(const aValue: string): string;
function URLSafeB64encode(const Value: string; IncludePadding: Boolean): string; overload; function URLSafeB64encode(const Value: string; IncludePadding: Boolean; AByteEncoding: IIdTextEncoding = nil): string; overload;
function URLSafeB64encode(const Value: TBytes; IncludePadding: Boolean): string; overload; function URLSafeB64encode(const Value: TBytes; IncludePadding: Boolean): string; overload;
function URLSafeB64Decode(const Value: string): string; function URLSafeB64Decode(const Value: string): string;
@ -979,12 +979,12 @@ begin
FFillChar := '='; { Do not Localize } FFillChar := '='; { Do not Localize }
end; end;
function URLSafeB64encode(const Value: string; IncludePadding: Boolean): string; overload; function URLSafeB64encode(const Value: string; IncludePadding: Boolean; AByteEncoding: IIdTextEncoding = nil): string; overload;
begin begin
if IncludePadding then if IncludePadding then
Result := TURLSafeEncode.EncodeString(Value) Result := TURLSafeEncode.EncodeString(Value, AByteEncoding)
else else
Result := TURLSafeEncode.EncodeString(Value).Replace('=', '', [rfReplaceAll]); Result := TURLSafeEncode.EncodeString(Value, AByteEncoding).Replace('=', '', [rfReplaceAll]);
end; end;
/// <summary> /// <summary>