1

I've realised I can't type some non-ASCII characters in the PowerShell console, all of which work fine in good old cmd.exe and should be supported by the code pages involved (it's a Spanish Windows edition with Spanish as only keyboard layout):

  • If I type it prints ?. When I hit enter I can see a normally looking euro sign in the error message:

    Test with '€'

  • If I type Á it doesn't print anything at all but I can print á just fine. Similarly, I can type lowercase ñ but not uppercase Ñ.

    Test with 'Á' and <code>á</code>

  • Interestingly, if I use clipboard to paste those chars I can see some of them:

    €ÁÑ

I happens in every Windows 10 PCs I've tried, with every TTF font I've tried.

Console code page is 850:

Current code page

Both [System.Console]::InputEncoding and [System.Console]::OutputEncoding show the same output:

IsSingleByte      : True
BodyName          : ibm850
EncodingName      : Europa occidental (DOS)
HeaderName        : ibm850
WebName           : ibm850
WindowsCodePage   : 1252
IsBrowserDisplay  : False
IsBrowserSave     : False
IsMailNewsDisplay : False
IsMailNewsSave    : False
EncoderFallback   : System.Text.InternalEncoderBestFitFallback
DecoderFallback   : System.Text.InternalDecoderBestFitFallback
IsReadOnly        : True
CodePage          : 850

Any idea of where to start looking?

Álvaro González
  • 1,551
  • 2
  • 17
  • 30
  • What about `$OutputEncoding`, `[System.Console]::OutputEncoding` and `[System.Console]::InputEncoding`? – JosefZ Dec 03 '19 at 20:00
  • @JosefZ I've edited the question. – Álvaro González Dec 04 '19 at 07:05
  • Maybe `$OutputEncoding` shows `CodePage: 20127` (us-ascii)? Try changing it as `$OutputEncoding = [System.Console]::OutputEncoding`. – JosefZ Dec 04 '19 at 17:47
  • @JosefZ You're right about the first part, it shows `US-ASCII` (is that meant to be the default?). But changing it to match `[System.Console]::OutputEncoding` doesn't change anything and there doesn't seem to be a similarly named `$InputEncoding`. – Álvaro González Dec 04 '19 at 17:52
  • I've had the chance of testing in a Windows Server 2012 machine via Remote Desktop and `Á` can be typed but `€` cannot. I have a strong feeling that it has never really worked at 100% but I didn't notice until I tried to set my full name in git credentials. Oh well... – Álvaro González Dec 05 '19 at 08:29
  • 1
    Would the [`Alt+x` method](https://superuser.com/a/1047961/376602) work? For instance, `Á`=`Alt+0193`=`Alt+181`, `á`=`Alt+0225`=`Alt+160`, `Ñ`=`Alt+0209`=`Alt+165` and `ñ`=`Alt+0241`=`Alt+164` in your locale CP850/ACP1252. – JosefZ Dec 05 '19 at 10:06
  • @JosefZ Yes, that works :-! – Álvaro González Dec 05 '19 at 10:23

0 Answers0