PowerShell / PowerShell/Win32-OpenSSH

Windows 10 ssh Unicode characters display as U+25A1 'WHITE SQUARE' □

Open
#1,623 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

Troubleshooting steps
https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps

Terminal issue? please go through wiki
https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH
I was optimistic that this would fix my issue, but alas it did not.

Please answer the following

"OpenSSH for Windows" version
((Get-Item (Get-Command ssh).Source).VersionInfo.FileVersion)
I have only added the ssh client to my Windows install, I did not add the ssh server, so I am getting the version of ssh instead of sshd: 7.7.2.1

Client OperatingSystem
Windows 10 Pro, here is my $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.0.2
PSEdition                      Core
GitCommitId                    7.0.2
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

What is failing
I am connecting via ssh to a Linux server, and am unable to draw Unicode characters. For example, the tree command just draws Unicode error boxes, instead of tree diagram characters. If I connect to this same server using PuTTy, I see all characters rendered correctly, so this does not seem to be a configuration issue on the ssh server end.

Expected output

user@host:/var/lib/nginx $ tree
.
├── body
├── fastcgi
├── proxy
│   ├── 1
│   │   └── 00
│   ├── 2
│   │   └── 00
│   └── 3
│       └── 00
├── scgi
└── uwsgi

Actual output

user@host:/var/lib/nginx $ tree
.
□□□ body
□□□ fastcgi
□□□ proxy
□□□ □□□ 1
□□□ □□□ □□□ 00
□□□ □□□ 2
□□□ □□□ □□□ 00
□□□ □□□ 3
□□□     □□□ 00
□□□ scgi
□□□ uwsgi

Amusingly, the box-rendered characters are in fact the correct Unicode characters. When I copied the incorrect tree rendering out of PowerShell in order to paste it into this bug report, the entire tree rendering pasted in correctly! So the characters are definitely being sent from the server to the ssh terminal correctly, it seems that ssh just doesn't want to render them correctly.

I am running ssh within PowerShell v7.0.2, where my $PROFILE includes the following:

$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$env:TERM = 'xterm'

(And I can successfully render all manner of Unicode characters in PowerShell itself.)

I did reproduce this erroneous ssh Unicode character rendering in cmd.exe just in case this was an issue specific to PowerShell, and I get the same behavior with the same Unicode error boxes in a CMD-hosted ssh session just as I do with PowerShell.

To my slight dismay, I get almost-correct Unicode character rendering in a Windows Terminal tab of either PowerShell 7 or CMD. It is still not 100% correct, but it is not Unicode error boxes either. Here is the same output from an ssh session within a Windows Terminal-hosted PowerShell 7 tab:

user@host:/var/lib/nginx $ tree
.
╺━━ body
╺━━ fastcgi
╺━━ proxy
    ╺━━ 1
        ╺━━ 00
    ╺━━ 2
        ╺━━ 00
    ╺━━ 3
        ╺━━ 00
╺━━ scgi
╺━━ uwsgi

...which calls into question whether this is truly an ssh issue, or some other Windows console-rendering bug. If you have any opinion on how best to determine that, I would be happy to re-file this issue in a more appropriate GitHub if it turns out not to be a problem with Windows ssh itself.

Also, I am using the exact same font in each of PowerShell, CMD, Windows Terminal, and PuTTy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the tree output with Win32-OpenSSH 7.7.2.1 from PowerShell 7.0.2 and cmd.exe, comparing Windows Terminal and PuTTY. Begin with the linked TTY/PTY support and Troubleshooting Steps wiki pages; determine whether the defect is in ssh or Windows console rendering, and consider it done when Unicode tree characters render correctly in the affected session.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.