[fpc-pascal] FPC vs Delphi's unicode string support questions

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Aug 18 17:07:33 CEST 2012


On 18 August 2012 15:15, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:
>> 1) Is it correct that String <> AnsiString any more?
> Well, it never was. At least "string" could also be a shortstring, maybe
> other strings too meanwhile (I don't know).

I guess I was a bit vague. All projects I work on and see these days
use {$H+} by default. In fact I don't know why FPC's hasn't changed
{$mode objfpc} to default to String = AnsiString a long time ago, but
that is another battle to fight another day.

>> 3) If false, what must I enable/toggle to say that String must now be a
>> Delphi unicode-type string.
> I don't know what a Delphi unicode-type string is exactly.

Please read the Delphi 2009 announcements. It was the biggest code
breaking change in Delphi in years! I have no idea how you could have
missed that. Anyway,  String = Unicode UTF-16 in Delphi 2009 and
newer. If you want the old behaviour, you have to explicitly define
each string variable as AnsiString.

> AFAIK UTF-8 is the prefered unicode string as it is used in the IDE and also

This is the FPC mailing list. The only IDE FPC has is the Free Pascal
Text IDE, and that definitely doesn't use UTF-8. ;-)

Anyway, thanks for your response. I'll hold off on the tiOPF v3 port
for now. There are too many undecided factors in FPC 2.7.1 at the

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-pascal mailing list