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

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed May 11 14:14:54 CEST 2016


On 2016-05-11 13:05, Jonas Maebe wrote:
> 
> Your concern is with utf8string, not with string/ansistring.

UTF8String is a AnsiString with utf-8 code page set.

 If you
> only use string/ansistring/unicodestring, then the behaviour of your  
> program will be identical with FPC 2.6.4 and 3.0. With utf8string, the  
> result is different in FPC 3.0 because now, just like when assigning  

No it's not. I welcome you to try the program yourself. The test program
includes a $DEFINE where I can toggle between using String or
UTF8String. Simply disable that define at the top of the unit.

I just double checked my results again. With u: String variable and
compiled with FPC 3.0 and running in a Latin-1 environment, data is
completely corrupted.

[unicode_test]$ export LANG=en_US.ISO8859-1
[unicode_test]$ ./unicodetest

And see the attached screenshot for the result of the data.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: with_fpc300_and_String_type.png
Type: image/png
Size: 6773 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160511/db28e656/attachment.png>


More information about the fpc-pascal mailing list