[fpc-devel] Encoded AnsiString

Michael Van Canneyt michael at freepascal.org
Tue Jan 7 12:27:30 CET 2014



On Tue, 7 Jan 2014, Michael Schnell wrote:

> On 01/07/2014 11:48 AM, Michael Van Canneyt wrote:
>> TRawByteString is what you need.
>> 
> AFAI was told by DXE users, this is not true. That is why i did not test this 
> yet. But as you state otherwise I will check into that.
>
> But anyway this does not help, as long as the RTL (especially TStrings, 
> TStringList) does not use such type, but forces a fixed type and thus 
> unnecessary conversions in and out. (there have been several discussion on 
> that, including how to implement decent encoding-checks in the compiler, and 
> performance issues).

We are well aware of that.

If you want a TStrings that can hold strings which may differ in their encoding 
(i.e. strings[0] has a different encoding from strings[1]) then you'll be left in the cold.

TStrings will not support that (unless maybe the rawbytestring type can be specified, 
I would need to check that).

Other than that, you can/must specify an encoding when creating the TStrings instance.
As a consequence all strings you add will be checked for this encoding. This is only logical.

That said, if you have use-case 1 (which I doubt, since it is not possible even today)
then you're better off using unicodestring anyway.

Michael.



More information about the fpc-devel mailing list