Recent

Author Topic: Windows Console working badly  (Read 1358 times)

lainz

  • Hero Member
  • *****
  • Posts: 3474
    • Lainz
Windows Console working badly
« on: January 18, 2020, 12:31:47 am »
Seems that from the latest update of Windows the console is not working well.

I mean the console attached to a GUI application, for debugging purposes.

Sometimes it displays nothing, some times it displays but not the entire text, and it displays badly the non ASCII characters- Like latin characters with tilde.

According to the setting of my console, it says Codepage 850 (OEM  - Latín Multilingüe)

How I can fix it? I tried the setting "Using the inherited console" (or whatever it translates "Usar la consola heredada") without success.

jamie

  • Hero Member
  • *****
  • Posts: 2313
Re: Windows Console working badly
« Reply #1 on: January 18, 2020, 02:27:39 am »
Have you tried to run some code accessing directly the API to get the current code page ?

Windows.GetCOnsoleCP;

See what it returns?
Number 1 at blue screen app creations!

josh

  • Hero Member
  • *****
  • Posts: 757
Re: Windows Console working badly
« Reply #2 on: January 18, 2020, 02:33:15 am »
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

lainz

  • Hero Member
  • *****
  • Posts: 3474
    • Lainz
Re: Windows Console working badly
« Reply #3 on: January 18, 2020, 01:59:44 pm »
Have you tried to run some code accessing directly the API to get the current code page ?

Windows.GetCOnsoleCP;

See what it returns?

It returns 850, the same code page that is listed in the properties of the console.

could it be related to this thread

https://forum.lazarus.freepascal.org/index.php/topic,47178.msg337202.html#msg337202


Yes, something like that. But, the problem is that turning on the compatibility mode doesn't works for me...
« Last Edit: January 18, 2020, 02:01:26 pm by lainz »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7934
Re: Windows Console working badly
« Reply #4 on: January 18, 2020, 02:07:27 pm »
If you have Windows 1903 and a very recent (after last tuesday) Lazarus you could try to go project options and turn on "Ansi codepage is UTF8 (Windows 10 1903+)".

lainz

  • Hero Member
  • *****
  • Posts: 3474
    • Lainz
Re: Windows Console working badly
« Reply #5 on: January 18, 2020, 02:16:43 pm »
If you have Windows 1903 and a very recent (after last tuesday) Lazarus you could try to go project options and turn on "Ansi codepage is UTF8 (Windows 10 1903+)".

Thanks. I'm upgrading to test that.

lainz

  • Hero Member
  • *****
  • Posts: 3474
    • Lainz
Re: Windows Console working badly
« Reply #6 on: January 18, 2020, 02:36:17 pm »
If you have Windows 1903 and a very recent (after last tuesday) Lazarus you could try to go project options and turn on "Ansi codepage is UTF8 (Windows 10 1903+)".

Tested and doesn't works. Maybe because my current codepage is not ANSI?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7934
Re: Windows Console working badly
« Reply #7 on: January 18, 2020, 02:38:12 pm »
Note that I assume you don't do scary things like using unit crt.

You might also want to try your program in a console started with

cmd /w

lainz

  • Hero Member
  • *****
  • Posts: 3474
    • Lainz
Re: Windows Console working badly
« Reply #8 on: January 18, 2020, 02:44:58 pm »
Note that I assume you don't do scary things like using unit crt.

You might also want to try your program in a console started with

cmd /w

Tested on a plain new GUI project, I mainly use the console for debugging. So it's compiled without -wg. Compiled from lazarus IDE.

Tested cmd /w and also PowerShell and none works.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7934
Re: Windows Console working badly
« Reply #9 on: January 18, 2020, 03:12:55 pm »
Then I'm out of options a bit.

I do use lazarus gui and console programs, but never really at the same time.

lainz

  • Hero Member
  • *****
  • Posts: 3474
    • Lainz
Re: Windows Console working badly
« Reply #10 on: January 18, 2020, 03:20:38 pm »
Then I'm out of options a bit.

I do use lazarus gui and console programs, but never really at the same time.

Ok. I forget to say, as well a normal console application doesn't works. It displays like in the screenshot, wrongly the ñ and ó characters.

Edit: I don't create console applications, just created one now to test...

But it was the latest Windows update, a week ago it was working fine.
« Last Edit: January 18, 2020, 03:29:02 pm by lainz »

ASBzone

  • Sr. Member
  • ****
  • Posts: 299
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: Windows Console working badly
« Reply #11 on: January 21, 2020, 09:13:39 pm »
Then I'm out of options a bit.

I do use lazarus gui and console programs, but never really at the same time.

Ok. I forget to say, as well a normal console application doesn't works. It displays like in the screenshot, wrongly the ñ and ó characters.

Edit: I don't create console applications, just created one now to test...

But it was the latest Windows update, a week ago it was working fine.


Can you provide the code for your test console program?  I write console programs for Windows all the time, and don't have any problems with the console generated.   And I'm on Windows 1909 (and I didn't have any issues while I was on 1903, either)       Specs in my sig...
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.7 r62618 / FPC v3.2.0-beta-r44160 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1909 (Build 18363.657)
Other Systems: Windows 10 Pro x64, Version 1909 or greater

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7934
Re: Windows Console working badly
« Reply #12 on: January 21, 2020, 09:34:27 pm »
Note that 1909 seems to report back as 1903 in some cases. Possibly effects of a later update.

lainz

  • Hero Member
  • *****
  • Posts: 3474
    • Lainz
Re: Windows Console working badly
« Reply #13 on: January 22, 2020, 12:46:59 am »
Code: Pascal  [Select]
  1. program Project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   Classes, LazUTF8
  10.   { you can add units after this };
  11.  
  12. begin
  13.   writeln('ñ');
  14.   writeln(UTF8ToAnsi('ñ'));
  15.   writeln(chr(164));
  16.   readln();
  17. end.
           
Here is the program. The first ñ look bad, the second and third looks fine.

ASBzone

  • Sr. Member
  • ****
  • Posts: 299
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: Windows Console working badly
« Reply #14 on: January 22, 2020, 04:17:24 am »
Note that 1909 seems to report back as 1903 in some cases. Possibly effects of a later update.


1909 is a "touch-up" update if you updated from 1903.  If you updated from anything before that, it is a full update.  But, as it was more of a stability/tweak upgrade than the past, many files are still 1903 editions.
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.7 r62618 / FPC v3.2.0-beta-r44160 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1909 (Build 18363.657)
Other Systems: Windows 10 Pro x64, Version 1909 or greater