Recent

Author Topic: WriteLn multilingual.  (Read 3337 times)

nouzi

  • Sr. Member
  • ****
  • Posts: 298
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 last version free pascal last version
Lazarus trunk  free pascal trunk 
System : Linux mint  64bit  Windows 7 64bit

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • 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