Skip to content

Windows 10 1809/19H1/20H1 breaks Powershell's console settings. Keeps opening with raster fonts. #280

Closed as not planned

Description

Windows 10 1809 breaks Powershell's console settings. Powershell keeps opening with raster fonts. You can change the settings and see the result, but when you open the settings again (with or without closing the powershell inbetween) the font has reset to raster fonts in size 12.

Edit: Upgraded from 1803. German Locale.

https://aka.ms/AA37kk1

Activity

  1. winstliu commented on Oct 14, 2018

    @winstliu
    Member

    The same happens to me only when using the Consolas font. If I use anything else - Courier New, Lucida Console, etc. - the settings are retained.

  2. danielniccoli commented on Oct 15, 2018

    @danielniccoli
    Author

    @50Wliu I can confirm that behaviour. Consolas resets to raster font. Lucida Console stays Lucida Console.

  3. added
    Product-Powershell
    on Oct 15, 2018
  4. zadjii-msft commented on Oct 15, 2018

    @zadjii-msft
    Member

    I'm almost certain this has to do with the fact that the new version of PSReadline is using the UTF8 codepage for displaying it's prompt, and when it does that, the console tries to recalculate the font.

    I thought we had some issues tracking this previously, but I can't seem to find them. Rich Turner (@bitcrazed) do you remember where they were? Or was it an internal mail thread with Jason Shirk (@lzybkr) and Steve Lee (@SteveL-MSFT)?

  5. SteveL-MSFT commented on Oct 15, 2018

    @SteveL-MSFT
    Member

    Can someone provide an exact repro? Like what font are you setting to the shortcut. What font is it being set to?

  6. danielniccoli commented on Oct 15, 2018

    @danielniccoli
    Author
    • Win-R and run powershell.
    • It starts with raster font.
    • Go into settings and set the font to Consolas. Click OK.
    • Consolas is being applied.
    • Close Powershell.
    • Reopen powershell like before.
    • Font is raster font again.
    • Go into default settings and set the font to Consolas. Click OK.
    • Close Powershell.
    • Reopen powershell like before.
    • Font is raster font again.
  7. miniksa commented on Oct 15, 2018

    @miniksa
    Contributor

    I don't think this was even Powershell's fault. I have a note sitting around here somewhere that one of the most recent .NET Frameworks (4.7something) suddenly decides to use 65001 as the default code page for all apps and when that flips back and forth with other tools and codepages as they start and exit, we recalculate the font.

    I have a bug on me to try to make that less painful, but it's really the sudden flipping between codepages that is making this be a problem.

  8. doctordns commented on Oct 17, 2018

    @doctordns

    I can't reproduce this here. Both Windows PowerShell and Powershell both start up in the font I set.

  9. cloudhan commented on Oct 17, 2018

    @cloudhan

    @Borkason Have you tried concfg clean
    https://github.com/lukesampson/concfg

  10. bitcrazed commented on Oct 17, 2018

    @bitcrazed
    Contributor

    @borakson - what locale is your Windows configured to use?

  11. winstliu commented on Oct 17, 2018

    @winstliu
    Member

    Rich Turner (@bitcrazed) I'm not @Borkason but since I'm experiencing this issue I'll answer as well.

    My display language is Spanish (Spain), and so is my regional format. The language for programs that don't support Unicode is English (United States), and I have the beta checkbox selected for UTF-8 Unicode. (Hope that's what you're looking for...let me know if you were asking for something else)

  12. danielniccoli commented on Oct 19, 2018

    @danielniccoli
    Author

    Rich Turner (@bitcrazed) German. And I upgraded from 1803. Forgot to meantion that.

  13. danielniccoli commented on Oct 19, 2018

    @danielniccoli
    Author
  14. doctordns commented on Oct 19, 2018

    @doctordns

    Thomas Lee (@doctordns) which font?

    I use Lucida Console (18 pt). But I've tested others and they too work after a restart of Windows PowerShell.

  15. danielniccoli commented on Oct 19, 2018

    @danielniccoli
    Author

    The same happens to me only when using the Consolas font. If I use anything else - Courier New, Lucida Console, etc. - the settings are retained.

  16. 75 remaining items

  17. edyu commented on Nov 20, 2019

    @edyu

    I "fixed" the problem by using Powershell Core. I first noticed that none of the Powershell settings does anything (but it did change the settings on cmd.exe). After a couple hours of trying different things I stumpled upon Powershell Core and as soon as I downloaded it, the settings I saved before took effect as soon as I opened the Powershell core preview.

  18. CHerSun commented on Apr 1, 2020

    @CHerSun

    Got the same issue while running some of commands (including scoop) from FAR manager - this effect just ruins how FAR is shown. Happens only with Consolas font and beta option enabled to use UTF-8 (65001) codepage in console. My locale is Russian.

    As end-user - It's really annoying when program tries to be smarter than me. I can live with question marks instead of some of UTF-8 symbols, but this font changing just ruins display of programs that shouldn't be affected at all, like FAR manger. This is a pain.

    For now I had to revert to Russian locale for console (back from UTF-8), yet this limits working with files named using symbols of other locales. I hope you can remove that special Consolas treating.

  19. dermoritz commented on Apr 12, 2020

    @dermoritz

    I have the same issue but only if i try to use consolas. probably Steve Lee (@SteveL-MSFT) is right.
    I tried Lucida Console and this is working fine. So i guess Consolas is missing some glyphs for utf-8 (my codepage)?!
    Powershell Core 7 works fine with all fonts.

  20. marcelomgarcia commented on May 23, 2020

    @marcelomgarcia

    Incredible, I bought a Windows laptop in 2020 (xps15) and I have the same issue. Probably hundreds of Windows updates later, and the problem persist. If PS Core was the future in 2019, why is not installed in 2020? The PS Core could be default, and maybe the old PS could be installed as fall back in case some one need for compatibility issue. Anyway, I installed the Windows Terminal and let's try it.

  21. doctordns commented on May 23, 2020

    @doctordns

    Marcelo Garcia (@marcelomgarcia) FWIW, the reason that PowerShell 7 is not installed in Windows by default is due to support and liability issues. Windows and PowerShell 7 have different support and so far as I can tell, the lawyers have not figured out a way to do it. For now, anyway. I am sure that everyone would love to see PowerShell 7 shipped inside Windows 10 or Windows Server.

    Rember: Windows PowerShell is a core component of Windows 10 and the default installer adds it to your installed on your laptop. It is a fully supported component FWIW. IF you want PowerShell 7, however, that is a separate and non-integrated installation process.

    What language is your computer?

  22. marcelomgarcia commented on May 23, 2020

    @marcelomgarcia

    Thanks for the explanation Thomas Lee (@doctordns). It's just somewhat frustrating issue, and for someone outside seems to be a "simple" problem. I'm install PowerShell 7.

    I use English US.

  23. alex-jitbit commented on Jun 4, 2021

    @alex-jitbit

    Observation: if you have a BAT file where you call powershell script.ps1 two times the second call resets font to raster.

    Inserting chcp 437 between the calls helps.

    More info https://superuser.com/questions/706562/why-does-running-powershell-change-my-console-font

  24. God-damnit-all commented on Jun 5, 2021

    @God-damnit-all

    Observation: if you have a BAT file where you call powershell script.ps1 two times the second call resets font to raster.

    I've confirmed it and I can see why this happens. Here's a script that illustrates the issue (and I tossed in my sleep function for funsies):

    @echo off && @echo|set /p="chcp; Write-Host "$args run complete"" > "%TEMP%\test.ps1"
    
    echo/This test assumes your default code page is 437 and your console font is set to Consolas (or another font that the raster font bug occurs with)
    call:sleep 5
    echo/
    echo/This should say the active code page is 437 . . .
    chcp
    call:sleep 3
    echo/
    echo/Running test.ps1 for the first time . . .
    call:sleep .25
    powershell.exe -ExecutionPolicy Unrestricted -File "%TEMP%\test.ps1" "First"
    call:sleep 3
    echo/
    echo/As you can see, the code page in PowerShell was changed to 65001, but after exiting, it still persists . . .
    call:sleep 1.5
    chcp
    call:sleep 3
    echo/
    echo/Now, watch what happens when we go into PowerShell with the code page already set to 65001 . . .
    call:sleep 4
    echo/
    echo/Running test.ps1 for the second time . . .
    call:sleep .25
    powershell.exe -ExecutionPolicy Unrestricted -File "%TEMP%\test.ps1" "Second"
    del "%TEMP%\test.ps1"
    call:sleep 3
    echo/
    echo/Assuming the bug is replicated, the console is now using a raster font
    call:sleep 3
    echo/
    echo/This concludes the test
    call:sleep 1.5
    echo/
    echo|set /p="[Done]" & runas /user:# "" >NUL 2>&1
    exit /b0
    
    ::Sleep function
    :sleep
    setlocal EnableDelayedExpansion
    set x=%1.
    set dec=%x:*.=%
    set int=!x:.%dec%=!
    set dec=%dec:.=%
    set dec=%dec:~0,3%
    if "%dec%"==".=" set dec=1000
    if "%dec%"=="~0,3" set dec=1000
    if %dec% LSS 10 set dec=%dec%00
    if %dec% LSS 100 set dec=%dec%0
    ping 203.0.113.0 -n 1 -w %int%%dec:~-3% >NUL
    endlocal

    Inserting chcp 437 between the calls helps.

    You can also put chcp 437 >$NULL in the ps1 file to prevent it as well.

  25. alabuzhev commented on Jul 24, 2021

    @alabuzhev
    Contributor

    when the default font was changed, East Asian users complained as their glyphs weren't being rendered since the font doesn't support it. So this code detects that the font and locale aren't compatible and switches it to one that will render.

    Steve Lee (@SteveL-MSFT), after #10472 & #10477 this is no longer the case - Consolas should be able to render everything.
    You might want to reconsider this and other similar workarounds, if any.

  26. githubkuyaya commented on Sep 22, 2021

    @githubkuyaya

    If your default codepage is 65001, this fix worked for me:
    run intl.cpl -> Administrative -> Change system locale -> Uncheck "Beta: Use Unicode [...] language support -> reboot

    This resets the codepage for PowerShell from 65001 to your local codepage (e.g. 437, 850) and it won't reset to raster font again.
    For reference, see this post

  27. CHerSun commented on Sep 22, 2021

    @CHerSun

    If your default codepage is 65001, this fix worked for me:
    run intl.cpl -> Administrative -> Change system locale -> Uncheck "Beta: Use Unicode [...] language support -> reboot

    This resets the codepage for PowerShell from 65001 to your local codepage (e.g. 437, 850) and it won't reset to raster font again.
    For reference, see this post

    This is a system-wide setting, which breaks older apps, that use regional code pages. I mean enabling the UTF-8. Should be off by default (beta).

  28. magiblot commented on Sep 20, 2023

    @magiblot

    In case it may be useful:

    If you want to work around this issue but you also need PowerShell to print Unicode text, you may switch to codepage 437 before running PowerShell and then change the console encoding from within PowerShell.

    For example, to get the clipboard contents in UTF-8:

    chcp 437 > NUL
    powershell -NoProfile -NoLogo -NonInteractive "([Console]::OutputEncoding = [System.Text.Encoding]::UTF8) -and (Get-Clipboard -Raw | Write-Host -NoNewLine) | Out-Null"

    This works for me using PowerShell 5.1.19041.1682, Windows 21H1.

  29. NikitaBeloglazov commented on Feb 16, 2024

    @NikitaBeloglazov
    chcp 437 > NUL
    powershell -NoProfile -NoLogo -NonInteractive "([Console]::OutputEncoding = [System.Text.Encoding]::UTF8) -and (Get-Clipboard -Raw | Write-Host -NoNewLine) | Out-Null"

    magiblot, Thank you so much! This helped me a lot ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FontsIssue-BugNeeds-Tag-FixProduct-Powershell

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions