Recent

Author Topic: WriteLn multilingual.  (Read 1032 times)

nouzi

  • Full Member
  • ***
  • Posts: 180
Re: WriteLn multilingual.
« Reply #15 on: February 15, 2020, 09:07:52 pm »
Semple way use
Code: Pascal  [Select][+][-]
  1. ....
  2. {$codepage UTF8}
  3. Begin
  4.  
  5.   WriteLn( 'Hello, Pascal') ;
  6.   WriteLn( 'Καλημέρα, Pascal');
  7.   WriteLn('Привет, Pascal');
  8.  
  9. End.
  10.  
  11.  

or
Install cmder
https://cmder.net/
« Last Edit: February 15, 2020, 09:14:00 pm by nouzi »
my english is  bad
Lazarus 2.0.6 free pascal 3.0.4
Lazarus trunk  free pascal trunk 
System : linux mint 19.3 64bit  windows 7 64bit

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8800
  • FPC developer.
Re: WriteLn multilingual.
« Reply #16 on: February 15, 2020, 09:36:14 pm »
Or use this unit

Code: Pascal  [Select][+][-]
  1. unit setdefaultcodepages;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows;
  7.  
  8. implementation
  9.  
  10. Const
  11.   LF_FACESIZE = 32;
  12.  
  13. Type
  14.   CONSOLE_FONT_INFOEX = record
  15.     cbSize     : ULONG;
  16.     nFont      : DWORD;
  17.     dwFontSize : COORD;
  18.     FontFamily : UINT;
  19.     FontWeight : UINT;
  20.     FaceName   : array [0..LF_FACESIZE-1] of WCHAR;
  21.   end;
  22.  
  23. { Only supported in Vista and onwards!}
  24.  
  25. function SetCurrentConsoleFontEx(hConsoleOutput: HANDLE; bMaximumWindow: BOOL; var CONSOLE_FONT_INFOEX): BOOL; stdcall; external kernel32;
  26.  
  27. var
  28.   New_CONSOLE_FONT_INFOEX: CONSOLE_FONT_INFOEX;
  29.  
  30. initialization
  31.  SetMultiByteConversionCodePage(CP_UTF8);
  32.  SetMultiByteRTLFileSystemCodePage(CP_UTF8);
  33.  
  34.   SetConsoleOutputCP(DefaultSystemCodePage);
  35.   SetTextCodePage(Output, DefaultSystemCodePage);
  36.  
  37.   FillChar(New_CONSOLE_FONT_INFOEX, SizeOf(CONSOLE_FONT_INFOEX), 0);
  38.   New_CONSOLE_FONT_INFOEX.cbSize := SizeOf(CONSOLE_FONT_INFOEX);
  39.   New_CONSOLE_FONT_INFOEX.FaceName := 'Consolas';
  40. //  New_CONSOLE_FONT_INFOEX.FaceName := 'Lucida Console';  //use Lucida Console for Win XP
  41.   New_CONSOLE_FONT_INFOEX.FontWeight := 400;
  42.   New_CONSOLE_FONT_INFOEX.dwFontSize.Y := 16;
  43.  
  44.   SetCurrentConsoleFontEx(StdOutputHandle, False, New_CONSOLE_FONT_INFOEX);
  45. end.

 

TinyPortal © 2005-2018