[fpc-pascal] Concatenating CP Strings

Jonas Maebe jonas at freepascal.org
Sat Sep 15 22:35:18 CEST 2018

On 15/09/18 22:32, Martok wrote:
> Gah, accidentally removed the comment that said what the actual problem is ;-)
>>    ReadLn(f, s);
>>    WriteLn(StringCodePage(s));
> That prints 1252, which is the DefaultSystemCodePage. At that point, information
> loss has already occured, there is no way to fix the CP in user code.
> I would expect reading from a file whose codepage I have just set to return
> strings in that codepage. Instead, I get the declared codepage of the string.

Setting the code page of a file tells the RTL about the encoding of the 
strings in the file. The string's static code page (which maps to 
DefaultSystemCodePage if none is specified) tells the compiler to which 
encoding this string data should be converted.


More information about the fpc-pascal mailing list