[fpc-pascal] code example where AnsiString used in FCL (SqlDB) causes data loss
Sven Barth
pascaldragon at googlemail.com
Wed May 11 20:01:42 CEST 2016
Am 11.05.2016 19:35 schrieb "Santiago A." <svaa at ciberpiula.net>:
> Something about codpages needs a second thought.
>
> a) There shouldn't be automatic conversion at all.
> b) The codepage of a string shouldn't change when you assign a string
with another codepage, just rise an error.
> c) Corollary of previous premises: Empty strings should also have
codepage.
The codepage aware ansistring was implemented for Delphi-compatibility so
this is highly unlikely to change.
> Extra 1) Beside calling SetSetcodepage, it would be handy that you could
set the codepage when you declare a string. I don't mean codepage should be
statically typed, just it would be handy.
A string is Nil upon it's declaration so there is nowhere where you could
store that information. It only has the static codepage that it had been
declared with.
> Extra 2) Being able to set the codepage statically, so that mismatch
codepage could be detected in compiler time, would be handy. In this case I
do mean codepage could also be statically typed,
Codepages are already set statically.
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160511/78f1dd26/attachment.html>
More information about the fpc-pascal
mailing list