[fpc-pascal] CP_NONE string disappearing

Jonas Maebe jonas at freepascal.org
Sun Dec 27 18:54:31 CET 2020


On 27/12/2020 18:36, Benito van der Zander via fpc-pascal wrote:
> this code:
> 
> program Project1;
> {$mode objfpc}{$H+}
> var a,b, c: string;
> begin
>   a := 'x';
>   b := 'y';
>   SetCodePage(RawByteString(b), CP_NONE, false);
>   c := a+b;
>   writeln(c);
> end.
> 
> prints x without y on win32/wine.
> 
> Is that supposed to happen?

https://wiki.freepascal.org/FPC_Unicode_support#Code_page_identifiers

"CP_NONE: this value indicates that no code page information has been
associated with the string data. The result of any operation on a string
that has this dynamic code page is undefined."


Jonas


More information about the fpc-pascal mailing list