[fpc-pascal] RTL and Unicode Strings

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed May 11 13:55:26 CEST 2016


On 2016-05-11 12:48, Michael Van Canneyt wrote:
> No, it does not save you, where did you get that from ?

It helps. Any encoding to UTF-16 (or UTF-8) is safe. The other way round
is not. There is no guarantee that String (or AnsiString) is using a
Unicode encoding. So depending on where you get your data from, in my
case that data is one of the Unicode encodings, doing a conversion to
anything other than another Unicode encoded variable (or RawByteString)
means I could loose data.

See my actual database example (with sample code) titled "code example
where AnsiString used in FCL (SqlDB) causes data loss" - whenever a
moderator releases that post to the mailing list. Otherwise I can
forward it to you in private.

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