Hi Danijel,
I hope this message finds you well. I just wanted to let you know I think I've found a bug in the function EncodeXMLrpc. When sending data between an RTC Server and c# XML-RPC client a string containing XML data will fail because the greater than character '>' isn't being escaped.
The current function looks like this:
function EncodeXMLrpc(const s:RtcString):RtcString;
var
a,b:integer;
begin
Result:='';
b:=length(s);
for a:=1 to length(s) do
case s[a] of
'<':Inc(b,3);
'&':Inc(b,4);
end;
SetLength(Result,b);
b:=1;
for a:=1 to length(s) do
case s[a] of
'<':begin
Result[b]:='&';
Result[b+1]:='l';
Result[b+2]:='t';
Result[b+3]:=';';
Inc(b,4);
end;
'&':begin
Result[b]:='&';
Result[b+1]:='a';
Result[b+2]:='m';
Result[b+3]:='p';
Result[b+4]:=';';
Inc(b,5);
end;
else
begin
Result[b]:=s[a];
Inc(b);
end;
end;
end;
And the corrected function should look like this:
function EncodeXMLrpc(const s:RtcString):RtcString;
var
a,b:integer;
begin
Result:='';
b:=length(s);
for a:=1 to length(s) do
case s[a] of
'<':Inc(b,3);
'>':Inc(b,3);
'&':Inc(b,4);
#39:Inc(b,6);
'"':Inc(b,5);
end;
SetLength(Result,b);
b:=1;
for a:=1 to length(s) do
case s[a] of
'<':begin
Result[b]:='&';
Result[b+1]:='l';
Result[b+2]:='t';
Result[b+3]:=';';
Inc(b,4);
end;
'>':begin
Result[b]:='&';
Result[b+1]:='g';
Result[b+2]:='t';
Result[b+3]:=';';
Inc(b,4);
end;
'&':begin
Result[b]:='&';
Result[b+1]:='a';
Result[b+2]:='m';
Result[b+3]:='p';
Result[b+4]:=';';
Inc(b,5);
end;
#39:begin
Result[b]:='&';
Result[b+1]:='a';
Result[b+2]:='p';
Result[b+3]:='o';
Result[b+4]:='s';
Result[b+5]:='s';
Result[b+6]:=';';
Inc(b,7);
end;
'"':begin
Result[b]:='&';
Result[b+1]:='q';
Result[b+2]:='u';
Result[b+3]:='o';
Result[b+4]:='t';
Result[b+5]:=';';
Inc(b,6);
end;
else
begin
Result[b]:=s[a];
Inc(b);
end;
end;
end;
I hope this helps.
Many thanks for all your efforts and the support you have given me in the past.
Kind regards,
Ryan