diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index 2ecbed88b..1ab628b14 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel.Server; using Microsoft.DotNet.Tools.Build; @@ -41,6 +42,8 @@ namespace Microsoft.DotNet.Cli { DebugHelper.HandleDebugSwitch(ref args); + InitializeProcess(); + try { return Program.ProcessArgs(args, new Telemetry()); @@ -138,6 +141,13 @@ namespace Microsoft.DotNet.Cli } + private static void InitializeProcess() + { + // by default, .NET Core doesn't have all code pages needed for Console apps. + // see the .NET Core Notes in https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + internal static bool TryGetBuiltInCommand(string commandName, out Func builtInCommand) { return s_builtIns.TryGetValue(commandName, out builtInCommand);