It appears that ReadFile bugs up once it hits Chr(26) (SUB). I'm wondering if there is a place specific for scripting core bugs, or even server bugs, because I don't feel Script Core Suggestions is the right place to report this.
procedure ActivateServer();
var
MyString: string;
begin
MyString := 'start' + #026 + 'notstart';
WriteLn('write file string length to ' + InttoStr(Length(MyString)));
WriteFile('./test.txt', MyString);
MyString := '';
MyString := ReadFile('./test.txt');
WriteLn(' read file string length is ' + InttoStr(Length(MyString)));
WriteFile('./test.txt', MyString);
WriteLn(' wrote copy of read file');
MyString := '';
MyString := ReadFile('./test.txt');
WriteLn(' read file string length is ' + InttoStr(Length(MyString)));
end;
And while I'm at it, the \r\n extra at the end is pretty annoying. If we didn't put it there, it should mean we don't want it!