[fpc-devel] String and UnicodeString and UTF8String
DrDiettrich1 at aol.com
Mon Jan 10 14:17:19 CET 2011
Jonas Maebe schrieb:
>> In current Delphi is String synonym for base type UnicodeString UTF-16
>> AFAIU ATM in FPC is String synonym for AnsiString (as in previos
>> versions of Delphi)
>> Are there any plans to change meaning of String type ?
>> (like Delphi to UnicodeString , or UTF8String?)
> If/when this is done, it will only be with a compiler switch or directive.
AFAIR Delphi doesn't offer such a compiler option, because units with
different settings do not fit together (2 VCL versions would not be
I'm not sure about details, but the Delphi designers certainly
encountered problems that definitely forbid mixing string types. One
such problem may be a slowdown due to many implicit string conversions,
together with compiler warnings about possible losses on the conversion
back to Ansi, and real losses as I observed in VB years ago. Another one
may be the maintenance of duplicate (overloaded) procedures in the
When FPC implements two distinct versions, adding another Unicode/Ansi
level to the unit output tree, both versions can be compiled from the
same source code, possibly using conditional compilation where necessary.
For my part, I'd be happy with two definitely different Ansi and UTF(8)
string types, with automatic conversion. But even then it would be wise
to add another string parameter type, like Delphi RawByteString, that
accepts both Ansi and UTF-8 arguments without implicit conversions.
More information about the fpc-devel