<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hello,</p>
<p>I have a simple FPC program:</p>
<p>---<br>
program GermanTest;<br>
<br>
{$codepage utf8}<br>
begin<br>
Writeln('');<br>
end.<br>
---</p>
<p>If I run it in the console, I see correct characters: <br>
</p>
<p><img src="cid:part1.CBA9A45F.3F701EF5@kluug.net" alt=""></p>
<p>BUT when I redirect the output to a file with ">" :</p>
<p>GermanTest.exe > GermanTest.txt I get corrupted characters
"" (see attachment).</p>
<p>I tried various possibilities but either the console output is
correct or the file output is correct. Never both of them.</p>
<p>E.g.<br>
---<br>
program GermanTest;<br>
<br>
{$codepage utf8}<br>
<br>
uses<br>
Windows, SysUtils, Classes;<br>
<br>
begin<br>
SetConsoleOutputCP(CP_UTF8);<br>
<br>
Writeln('');<br>
end.<br>
---</p>
<p>Works fine for file output but the console shows wrong
characters.</p>
<p>What should I do so that both outputs are correct? Or is it an
FPC bug? Delphi works fine - both outputs are correct.</p>
<p>FPC version: current trunk 3.1.1 Windows, 32bit.<br>
OS: Windows 10, 64bit</p>
<p>Ondrej<br>
</p>
</body>
</html>