There's the command line version of my example,
Does NOT work when I compile this using fpc 2.6.4 => non-unicode executable
While fpc 3.x was crashing last time I tried building my project using it => no executable at all
Which one would you prefer? One that works badly or one that does not work at all?
That is the difference between fpc 2.6.4 (lame but stable) and fpc 3.x (supposedly better but chokes on internal errors).
P.S. And fpc 3.0.2 IS STILL INCOMPLETE:
See this example:
Code:
{$codepage utf-8}
{$mode objfpc}
program Test;
uses
SysUtils, classes;
var
AFileNameConsistingEntirelyOfUnicodeCharacters: AnsiString;
s: TFileStream;
begin
AFileNameConsistingEntirelyOfUnicodeCharacters := '௵௵௵௵實實實電電電電參參參ݠݠݼݼݼݼݼਈਈਈ.txt';
if FileExists('d:\tmp\test\' + AFileNameConsistingEntirelyOfUnicodeCharacters) = True then
WriteLn('It exists!')
else WriteLn('false.');
try
s:= TFileStream.Create('d:\tmp\test\' + AFileNameConsistingEntirelyOfUnicodeCharacters, fmOpenRead);
s.Free;
except
WriteLn((ExceptObject as Exception).Message);
end;
readln;
end.
Now see it FAIL to open a stream:
Code:
It exists!
Unable to open file "d:\tmp\test\????????????????????????.txt"
That's it folks. The RTL may be Unicode now (FileExists & friends) but CLASSES ARE NOT!
P.S. That's why I have a hack in my engine to be used with FPC 3, containing modified versions of TFileStream, TIniFile and TStrings.
I hope it will not be needed someday.
But as it is, FPC 3 was rolled out prematurely. It should've stayed 2.9.x for a while longer.
P.P.S. I was planning to make a similar patch for fpc 2.6.4 with Unicode FileExists & friends, but I decided: why bother when fpc 3 would be there soon. Yeah. That 'soon' proved to be relative
Bookmarks