Skip to content

Consider setting Console.OutputEncoding for dotnet test and friends #4605

@bradwilson

Description

@bradwilson

There was a change in Windows Terminal 1.17 that causes .NET applications that output Unicode characters to the console to have them garbled, because of the default output encoding. This does not happen in prior versions of Windows Terminal, nor in classic "conhost.exe" console windows.

xUnit.net uses characters which are corrupted now when run on Windows Terminal through dotnet test and friends.

Output from xunit.console.exe:

image

Output from dotnet test (in Windows Terminal-hosted Powershell):

image

Output from dotnet test (in conhost-hosted Powershell):

image

While strictly speaking this isn't a bug in VSTest (or xUnit.net), we opted fixed this in xunit/xunit@c4b6ed0 on our side. I would recommend that you consider doing this as well, so that any output from testing frameworks which is outside of ASCII can be presented properly in Windows Terminal.

AB#1865057

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions