[fpc-pascal] PChars and AnsiString Code Pages

Tony Whyman tony.whyman at mccallumwhyman.com
Wed May 18 17:11:33 CEST 2016


On 18/05/16 14:27, Jonas Maebe wrote:
>>   s := string(Buf); {seems to work - but should it?}
>> end;
>
> Why shouldn't it? 

Because I couldn't find any documentation saying this should work and I 
wasn't sure if this worked by luck or design.

> To repeat what I said in about every message in the previous 
> disinformation thread on this topic: everything will work exactly the 
> same in FPC 2.6.4 and FPC 3.0 if you use the same types (with the same 
> effective modes/modeswitch) in both FPC versions, except for 
> utf8string (which is an alias for ansistring in FPC 2.6.4, and an 
> ansistring(CP_UTF8) in FPC 3.0).

Yes. I know you've said that, but the problem with such a statement is 
that it only applies to what is supposed to work and undocumented 
features that worked in the past may no longer be valid once the 
implementation has been updated.

While the online documentation says a lot about tyepcasting PChars to 
AnsiStrings, there seems to be nothing on the reverse.

Tony Whyman



More information about the fpc-pascal mailing list