Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set console encoding to UTF8 #4649

Merged
merged 2 commits into from Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -57,6 +57,9 @@ internal partial class FeatureFlag : IFeatureFlag
// Disable the SerialTestRunDecorator
public const string DISABLE_SERIALTESTRUN_DECORATOR = VSTEST_ + nameof(DISABLE_SERIALTESTRUN_DECORATOR);

// Disable setting UTF8 encoding in console.
public const string DISABlE_UTF8_CONSOLE_ENCODING = VSTEST_ + nameof(DISABlE_UTF8_CONSOLE_ENCODING);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason DISABLE has a lowercase 'l' ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish I could say I am testing your attention, but I have no idea why. My fingers must have typed it that way. I sometimes type 0 instead of o or O, and vice versa. I guess this is another quirk of l L and 1 looking the same and my brain working in visual way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That comment makes no sense. Probably just typed l without pressing shift, I don't have any caps lock. Fixed.


[Obsolete("Only use this in tests.")]
internal static void Reset()
{
Expand Down
7 changes: 7 additions & 0 deletions src/vstest.console/Program.cs
@@ -1,6 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Text;
using System;

using Microsoft.VisualStudio.TestPlatform.Execution;
using Microsoft.VisualStudio.TestPlatform.Utilities;

Expand All @@ -20,6 +23,10 @@ public static class Program

internal static int Run(string[]? args, UiLanguageOverride uiLanguageOverride)
{
if (!FeatureFlag.Instance.IsSet(FeatureFlag.DISABlE_UTF8_CONSOLE_ENCODING))
{
Console.OutputEncoding = Encoding.UTF8;
}
uiLanguageOverride.SetCultureSpecifiedByUser();
return new Executor(ConsoleOutput.Instance).Execute(args);
}
Expand Down