[fpc-pascal] Concatenating CP Strings

Martok listbox at martoks-place.de
Sun Sep 16 13:31:38 CEST 2018


Am 16.09.2018 um 12:35 schrieb Sven Barth via fpc-pascal:
> If you want the content to *be* in code page 866 without any tricks then
> you need to declare a AnsiString with that code page and use that:
> 
> === code begin ===
> 
> type
>   TCP866String = type AnsiString(866);
That only works if the codepage is known at compile time.

Let's say the user directs a program to "treat this file as $codepage".
Therefore, I need to read it as this codepage and fill internal data structures
with strings in that codepage, while keeping other operations in the system
codepage (so I can't just change DefaultSystemCodepage). Does that mean that
there is no way to do this with native strings?

> TL;DR: "AnsiString"/"String" is a type that has the code page that was
> determined at startup, not one that turns itself into whatever code page
> gets thrown at it
Actually, there is a String type that is just that (at least according to the
wiki): RawByteString. Supposedly, it just accepts any dynamic codepage without
conversion. But it doesn't work for either of the cases here?

--
Regards,
Martok




More information about the fpc-pascal mailing list