From 4d68a87409cfcdffc00b1778c5b1ad0c4b12b3d1 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Date: Tue, 10 Jun 2014 06:27:17 +0200 Subject: [PATCH] Trying to use UTF8 in Windows console. I give up. --- Allgemeines/ProcessLauncher/ProcessLauncher/Program.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Allgemeines/ProcessLauncher/ProcessLauncher/Program.cs b/Allgemeines/ProcessLauncher/ProcessLauncher/Program.cs index b9e6bea..dae0926 100644 --- a/Allgemeines/ProcessLauncher/ProcessLauncher/Program.cs +++ b/Allgemeines/ProcessLauncher/ProcessLauncher/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Text; namespace ProcessLauncher { @@ -7,14 +8,17 @@ namespace ProcessLauncher public static void Main(string[] args) { LinuxWindowsProcess process = new LinuxWindowsProcess(); - Console.WriteLine("Linux"); - var linuxOutput = process.Test("ls", "-lah"); - Console.WriteLine("stdout: {0}", linuxOutput.ToString()); + //Console.WriteLine("Linux"); + //var linuxOutput = process.Test("ls", "-lah"); + //Console.WriteLine("stdout: {0}", linuxOutput.ToString()); + // I need to change the console font :/ So even using UTF8 encoding this is not going to work. :( + Console.OutputEncoding = Encoding.UTF8; Console.WriteLine("Windows"); - var windowsOutput = process.Test("cmd.exe", "/C dir /A"); + // UTF8 is 65001 code page. :O + // see: http://ss64.com/nt/cmd.html + var windowsOutput = process.Test("cmd.exe", "/C chcp 65001 && dir /A"); Console.WriteLine("stdout: {0}", windowsOutput.ToString()); - Console.ReadLine(); } } -- 2.1.4