[Lazarus] dynamic string proposal

Michael Schnell mschnell at lumino.de
Wed Aug 16 15:23:18 CEST 2017


On 16.08.2017 14:43, Mattias Gaertner via Lazarus wrote:
> For some unknown
> reason you want to store different encodings in a TStrings and fear
> the "time-consuming" and loss-prone auto conversions.
It's obvious that a user using a different encoding brand in a string 
var than that suggested by TStrings (UTF-8 in fpc, UTF-16 in Delphi) 
implicitly triggers auto-conversion when handling the string. This has 
several consequences.

It might be a really good idea when e.g. doing some code that in a loop 
needs certain operation that might be very fast with UTF-16 but 
TStringList would store the data in a more compact way.

It might be time consuming when the conversion is done without being 
necessary.

It might be error pone when the user stores some random stuff in the 
string that is not able to be handled by the conversion forth and back.

In any case all this happens without the user being aware of, which 
might cause frustration.

-Michael


More information about the Lazarus mailing list