Skip to content

Commit 20bb284

Browse files
committed
Sets output encoding to UTF8 if output is redirected
1 parent 0c2b42d commit 20bb284

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

netmockery/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.IO;
77
using System.Linq;
88
using System.Reflection;
9+
using System.Text;
910
using System.Threading.Tasks;
1011
using static System.Console;
1112

@@ -33,6 +34,10 @@ private static IWebHost CreateWebHost(string contentRoot)
3334

3435
public static void Main(string[] args)
3536
{
37+
if (IsOutputRedirected)
38+
{
39+
OutputEncoding = Encoding.UTF8;
40+
}
3641
System.Net.ServicePointManager.ServerCertificateValidationCallback =
3742
((sender, certificate, chain, sslPolicyErrors) => true);
3843
if (args.Length >= 1)

0 commit comments

Comments
 (0)