例如:
s:= 'http://detail.tmall.com/item.htm?id=45545826531&abbucket=_AB-M129_B17&acm=03130.1003.1.161728&aldid=4HatiDee&abtest=_AB-LR129-PV129_1393&scm=1003.1.03130.13_45545826531_161728&pos=6#detail';
s:=Encoding(s); //加密后的字符串中间就会多了#$D#$A,例如'ABCDDDD'#$D#$A'DDESDFGF'
该单元为你的Delphi安装目录下,解决方法是将该单元放到你的程序源代码文件夹下,并Shift+F11在项目中添加该单元,这样就会引用你程序单元的EncdDecd.pas,而不会去引用delphi安装目录下的EncdDecd.pas单元。
并且要增加一行代码,替换掉那个字符串:
function EncodeString(const Input: string): string;
var
InStr, OutStr: TStringStream;
str_result : string;
begin
InStr := TStringStream.Create(Input);
try
OutStr := TStringStream.Create('');
try
EncodeStream(InStr, OutStr);
str_result := OutStr.DataString;
str_result := StringReplace(str_result,#$D#$A,'',[rfReplaceAll,rfIgnoreCase]); //增加代码!!!
Result := str_result;
finally
OutStr.Free;
end;
finally
InStr.Free;
end;
end;