Skip to content

How to get UTF-8 to work properly from a Linux SSH client #2468

Open

Description

@rdiez

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

How do I get UTF-8 to work properly from a Linux SSH client?

$ ssh MyWindowsPC "echo ä"
\204

Octal 204 = decimal 132 = hexadecimal 84 is the code for 'ä' in Code Page 437.

UTF-8 works fine on my Linux box. Environment variable LANG is set to "en_US.UTF-8".

Expected behavior

$ ssh MyWindowsPC "echo ä"
ä

Actual behavior

$ ssh MyWindowsPC "echo ä"
\204

Error details

Environment data

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.20348.5386                                                                          
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.20348.5386                                                                         
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1

Version

OpenSSH_for_Windows_9.5p2, LibreSSL 3.8.2

Visuals

No response

Activity

  1. github-actions commented on Oct 11, 2026

    @github-actions

    This looks like a Windows-specific UTF-8/codepage handling issue for remote commands executed through sshd, so I’m marking it for maintainer investigation.

    For maintainers
    • Windows-specific vs. parity: This appears Windows-specific rather than a general upstream OpenSSH bug. The reported output maps ä to CP437 (0x84) and the server side is OpenSSH_for_Windows running PowerShell 5.1 on Windows build 10.0.20348, so the likely fix area is Windows process/console/codepage handling in PowerShell/openssh-portable. Confidence: medium-high.
    • Reproducibility: The report includes a minimal command (ssh MyWindowsPC "echo ä"), expected/actual output, and OpenSSH_for_Windows version (9.5p2). It does not name the Linux client distribution/version or the exact remote shell/codepage settings, but the core repro is specific enough for initial investigation. Confidence: medium.
    • Copilot-fix suitability: Maybe. This may be localized if the problem is command encoding/codepage setup around Windows child process launch, but terminal/console encoding behavior can be subtle and may need maintainer validation across shells.
    • Likely area: Area-sshd and Area-Terminal because the symptom occurs when a Linux SSH client invokes a command on the Windows sshd server and receives escaped/non-UTF-8 output from the remote command path.
    Related issues checked

    Generated by Agentic Issue Triage for issue #2468 · 63.9 AIC · ⌖ 18.2 AIC · ⊞ 20.1K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@2f03fdaafb8c1ae62dfde7e0be762a822a201aeb
    
  2. jborean93 commented on Oct 12, 2026

    @jborean93

    It really depends on what the target default shell is and the configured console codepage. For example my target DefautlShell is powershell.exe so I need to explicitly change the codepage with chcp 65001 or [Console]::OutputEncoding = [Text.UTF8Encoding]::new() to tell PowerShell it can emit characters using UTF-8 bytes.

    Image

    Windows does not set the console output codepage to UTF-8 by default for compatibility issues so you essentially need to tell it that UTF-8 is ok.

    If your default shell is cmd (the default if not configured) then doing chcp 65001 && echo ä should work but I've not tested that.

  3. rdiez commented on Oct 12, 2026

    @rdiez
    Author

    I think the default shell on my Windows Server target is cmd. I tested it like this:

    $ ssh MyWindowsPC ver
    Microsoft Windows [Version 10.0.20348.5386]
    

    This does not work:

    $ ssh MyWindowsPC "chcp 65001 && echo ä"
    Aktive Codepage: 65001.
    \204
    

    However, this does work:

    $ ssh MyWindowsPC "chcp 65001 && cmd /c \"echo ä\""
    Aktive Codepage: 65001.
    ä
    

    But that trick does not always work:

    $ ssh MyWindowsPC "chcp 65001 && cmd /c \"quser /server:make_it_fail\""                                                                                                        Aktive Codepage: 65001.
    Fehler 0x000006BA beim Auswerten der Sitzungsnamen
    Fehler [1722]:Der RPC-Server ist nicht verf\201gbar.
    

    The \201 on the last line should actually be 'ü'.

    So it looks like the chcp 65001 is not been set or propagated properly in all cases.

  4. jborean93 commented on Oct 12, 2026

    @jborean93

    I do see that when cmd is the default shell the chcp command didn't apply to the current process and I had to spawn a new one so it saw the new console codepage changes.

    Image

    As for why quser still returns the \201 escape sequence I am not sure sorry. It could be that quser doesn't respect the console code page and always returns it in some other encoding. You could rule this out by opening cmd interactively on the Windows host and run the same chcp 65001 then the quser ... and redirect stdout/stderr to a file. From there you can inspect the raw bytes or use Format-Hex -Path ... in PowerShell to see whether the ü is UTF-8 encoded (quser respects the codepage) or something else (quser does not).

    Ultimately this is a tricky thing, SSH just returns back the raw bytes it receives on the stdout/stderr so it is up to the applications that write to stdout/stderr to emit using the expected encoding. If there is a misalignment then you get issues like this where your client cannot render what the remote had emitted.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions