Hello,

I have a simple FPC program:

---
program GermanTest;

{$codepage utf8}
begin
  Writeln('ÄäÖöÜüß');
end.
---

If I run it in the console, I see correct characters:

BUT when I redirect the output to a file with ">" :

GermanTest.exe > GermanTest.txt I get corrupted characters "Ž„™”š�á" (see attachment).

I tried various possibilities but either the console output is correct or the file output is correct. Never both of them.

E.g.
---
program GermanTest;

{$codepage utf8}

uses
  Windows, SysUtils, Classes;

begin
  SetConsoleOutputCP(CP_UTF8);

  Writeln('ÄäÖöÜüß');
end.
---

Works fine for file output but the console shows wrong characters.

What should I do so that both outputs are correct? Or is it an FPC bug? Delphi works fine - both outputs are correct.

FPC version: current trunk 3.1.1 Windows, 32bit.
OS: Windows 10, 64bit

Ondrej

У„УЄУ–УЖУœУМУŸ
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to