[fpc-pascal] code example where AnsiString used in FCL (SqlDB) causes data loss

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed May 11 15:00:42 CEST 2016


On 2016-05-11 13:27, Jonas Maebe wrote:
> If you change the string to unicodestring (since  
> FPC 2.6.4 does not know {$modeswitch unicodestring}), you should get  
> the same results in FPC 2.6.4 and FPC 3.x

No, because FPC 2.6.4 doesn't do automatic encoding conversions. I would
first have to add UTF8Decode() calls wherever I assign known UTF-8 data
to a UnicodeString.

With FPC 2.6.4 I never use UnicodeString. Like with Lazarus LCL, I use
AnsiString with a UTF-8 payload. I define a new type which I use in my
application to remind me of that fact.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list