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.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to