Forum > General

Console in/output utf in lazarus 2.0.0

(1/2) > >>

benohb:
linux 64 gtk laz 2.0.0

I have tried

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Writeln('لازاروس');
The result

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---??????????????
I change output style to hex

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---d9 84 d8 a7 d8 b2 d8 a7 d8 b1 d9 88 d8 b3
So .. its utf8 ..
Does it Console in/output  support UTF  ???  and how back to old behavior

Bart:
Your console font must support outputting those characters as well.

I got this unit from a discussion on the forum here:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit setdefaultcodepages; interface uses  Windows; implementation Const  LF_FACESIZE = 32; Type  CONSOLE_FONT_INFOEX = record    cbSize      : ULONG;    nFont       : DWORD;    dwFontSizeX : SHORT;    dwFontSizeY : SHORT;    FontFamily  : UINT;    FontWeight  : UINT;    FaceName    : array [0..LF_FACESIZE-1] of WCHAR;  end; { Only supported in Vista and onwards!} function SetCurrentConsoleFontEx(hConsoleOutput: HANDLE; bMaximumWindow: BOOL; var CONSOLE_FONT_INFOEX): BOOL; stdcall; external 'kernel32.dll' name 'SetCurrentConsoleFontEx';var  New_CONSOLE_FONT_INFOEX : CONSOLE_FONT_INFOEX; initialization  writeln('SetDefaultCodepages unit initialization: DefaultSystemCodePage = ',DefaultSystemCodePage);  {$ifdef DisableUTF8RTL}  SetConsoleOutputCP(DefaultSystemCodePage);  SetTextCodepage(Output, DefaultSystemCodePage);  {$else}  SetConsoleOutputCP(cp_utf8);  SetTextCodepage(Output, cp_utf8);  {$endif}   FillChar(New_CONSOLE_FONT_INFOEX, SizeOf(CONSOLE_FONT_INFOEX), 0);  New_CONSOLE_FONT_INFOEX.cbSize := SizeOf(CONSOLE_FONT_INFOEX);//  New_CONSOLE_FONT_INFOEX.FaceName := 'Lucida Console';  New_CONSOLE_FONT_INFOEX.FaceName := 'Consolas';  New_CONSOLE_FONT_INFOEX.dwFontSizeX := 8;  New_CONSOLE_FONT_INFOEX.dwFontSizeY := 16;   SetCurrentConsoleFontEx(StdOutputHandle, False, New_CONSOLE_FONT_INFOEX);end.
IIRC that does the trick.

Bart

Thaddy:
Bart, that's windows centric and not Linux....

Note the code from the question  works in my RPi terminal.

benohb:

@Bart It is linux

http://wiki.freepascal.org/Lazarus_with_FPC3.0_without_UTF-8_mode#Problem_System_encoding_and_Console_encoding_.28Windows.29


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Console output codepage: 0System codepage: 65001????????

SetTextCodePage(Output, 65001);




--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Console output codepage: 65001System codepage: 65001???????? 

Nothing has changed
Also I can not use the debugger with the external xtrem ..  There is also a problem

benohb:
Solved in svn .. I wish to update the Linux stable package :D :D

Navigation

[0] Message Index

[#] Next page

Go to full version