Win32: the default encoding for FILE_TYPE_DISK output is the console codepage instead of DefaultSystemCodePage
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
If you redirect output to a file:
myprogram.exe > output.txt
the resulting output.txt file is in the console codepage instead of DefaultSystemCodePage.
This is different to Delphi.
Steps to reproduce:
Redirect output of this file to a text file (on a German OS):
program GermanTest;
{$codepage utf8}
uses
Windows, SysUtils;
begin
{ // uncomment to enable workaround:
if GetFileType(TTextRec(Output).Handle) <> FILE_TYPE_CHAR then
SetTextCodePage(Output, DefaultSystemCodePage);}
Writeln('ÄäÖöÜüß');
end.
and check the file encoding.
Additional information:
Patch attached.
Mantis conversion info:
- Mantis ID: 31746
- Build: 35881
- Version: 3.1.1