WebGetPostData converts characters to HTML
Paul Timms
2-2-24
Operating system: macOS
A change has been made to the function WebGetPostData between 8.5 2023-03-16 and 8.5 2024-01-27. In the latter version, it is encoding special characters in HTML, for example a quotation mark becomes ". Is this change by design or is it a bug? If it's by design, this is a major change that we need to consider when upgrading customer systems.

Note that WebGetRawPostData does not do any conversion of characters, so a workaround/fix is to change HAL code to use this instead.
2-22-24
Hi, have same problem. I have a temporary solution with HAL. But think is better to fix this in core.

procedure ReplaceWebStrings(var string tstr,var longint movcnt)
begin
integer i,l;

l = len(tstr);

movcnt = 0;
for (i = 0; i < l;i = i + 1) begin
movcnt = movcnt + 1;

if mid(tstr,i,4)=="<" then begin
tstr = left(tstr,i) & "<" & right(tstr,l-i-4);
l = l - 3;
movcnt = movcnt + 3;
end;
if mid(tstr,i,4)==">" then begin
tstr = left(tstr,i) & ">" & right(tstr,l-i-4);
l = l - 3;
movcnt = movcnt + 3;
end;
if mid(tstr,i,6)=="'" then begin
tstr = left(tstr,i) & "'" & right(tstr,l-i-6);
l = l - 5;
movcnt = movcnt + 5;

end;
if mid(tstr,i,6)==""" then begin
tstr = left(tstr,i) & "\"" & right(tstr,l-i-6);

l = l - 5;
movcnt = movcnt + 5;
end;
if movcnt>220 then begin
tstr = left(tstr,len(tstr)-(255-movcnt));
i = l;
end;
end;

return;
end;


global
procedure FixAreaWebStrings(var area FileArea)
begin
area newArea;
string 255 tstr;
longint asize,pos,movcnt;

SetAreaZeroSize(newArea);
asize = GetAreaLength(FileArea);

pos = 0;
while pos < asize begin
tstr = GetStringFromArea(FileArea,pos,255);
ReplaceWebStrings(tstr,movcnt);
pos = pos + movcnt;

if movcnt==0 then begin
pos = pos + 1;
end;
AddTextToArea(tstr,newArea);
end;
SetAreaZeroSize(FileArea);
InsertAreaBeforeArea(newArea,FileArea);
return;
end;

global webpublic procedure WebGetJSON()

begin
area reqst;
json jobj;


webgetpostdata(reqst);
FixAreaWebStrings(reqst);
jobj = parsejsonarea(reqst);

return;
end;
4-9-24
Hi Paul!

Thanks for your message! I'll forward this to our development for further investigation.

We will keep you posted in progress.
View all Questions
Back to the list
Latest Posts
David Delač
Hi Gastón, Please report a bug in our issue tracker and attach test database that you can repeat this in so I can have a look. Paste subject here once done...
09:46 14 May 2025
Paul Timms
From what I&apos;ve read, using these will store the updated records in memory and then write them to the database in bulk, instead of each record writing to the database in turn. So perhaps there&apo...
17:53 29 Apr 2025