[fpc-devel] How to set code page in terminal? (Windows)

silvioprog silvioprog at gmail.com
Thu Jun 21 23:39:08 CEST 2012


Hello,

I'm trying to write "Atenção" in terminal, but it writes "At├º├úo"
instead of "Atenção" (please see http://imagebin.org/217387 ). :(

On Linux it's OK.

My test code is (or zip in attached):

------------------------------------------------------------
program test;

{$mode objfpc}{$H+}

{$IFDEF MSWINDOWS}
uses
  windows;
{$ENDIF}

const
  C = 'Atenção';
begin
{$IFDEF MSWINDOWS}
  SetConsoleOutputCP(CP_UTF8);
  SetTextCodePage(Output, CP_UTF8);
{$ENDIF}
  WriteLn(C);
end.
------------------------------------------------------------

Lazarus 1.1 r37649 FPC 2.7.1 i386-win32-win32/win64 | Windows 7 - 64

Thanks.

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cp.zip
Type: application/zip
Size: 1375 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120621/57b00732/attachment.zip>


More information about the fpc-devel mailing list