Hi,
Is there some FPC unicode wiki roadmap / status page? Something like Lazarus has for it's widgetsets [http://wiki.freepascal.org/Roadmap]
For many years now the tiOPF project has two major versions being maintained because FPC lagged behind on Delphi's Unicode support. We have tiOPF2 which works with FPC and Delphi 7-2007, and tiOPF3 which only works with Delphi 2009 and later.
Today I grabbed the latest FPC 3.1.1 and tried to compile tiOPF3 (which currently only works with D2009 and later). From the wiki pages I found that I need to enable {$MODESWITCH UNICODESTRINGS} so that the String type is interpreted as UnicodeString. This got FPC through a couple of units.
Now I'm getting an error with a SysUtils function FmtStr()
tiCommandLineParams.pas(152,18) Error: Call by var for arg no. 1 has to
match exactly: Got "UnicodeString" expected "AnsiString"The code looks as follows:
function TtiCommandLineParams.GetAsString: string;
var
LArgIndex, LMAxArgIndex: integer;
begin
LMAxArgIndex := FCLParams.ParamCount;
for LArgIndex := 1 to LMAxArgIndex do
FmtStr(Result, '%s%s ', [Result, FCLParams.ParamStr(LArgIndex)]); //
<<< error here
Result := Trim(Result);
end;So it seems the SysUtis doesn't have a UnicodeString version of FmtStr(). But then I remembered that there was talks about a AnsiString RTL and a UnicodeString RTL. Is that switch not automatically done if I use modeswitch UnicodeString? If not, how to I enable the Unicode RTL?
Also I get (as expected) lots of compiler warnings. For example:
tiBaseObject.pas(9,5) Hint: Unit "uuchar" not used in tiBaseObject
tiCommandLineParams.pas(158,34) Warning: Implicit string type conversion
with potential data loss from "UnicodeString" to "AnsiString"
tiCommandLineParams.pas(158,20) Warning: Implicit string type conversion
from "AnsiString" to "UnicodeString"The "uuchar" is a weird one, because there is no uuchar unit referenced in any of the uses clauses. So I'm presuming that FPC injects that automatically - but then why complain about it?
Am I maybe jumping the gun by trying to use FPC 3.1.1 with tiOPF3? Is FPC's Unicode support not yet in a usable state with Delphi 2009+ code?
Regards,
- Graeme -
