Skip to content

Commit

Permalink
Merge pull request #598 from nabychan/dev
Browse files Browse the repository at this point in the history
config encoding For Stdio
  • Loading branch information
DustinCampbell authored Jul 2, 2016
2 parents a1cf5f9 + e01e8ae commit f4d1dbf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/OmniSharp.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -30,6 +31,7 @@ public static void Main(string[] args)
var otherArgs = new List<string>();
var plugins = new List<string>();
var serverInterface = "localhost";
Encoding encoding = null;

var enumerator = args.GetEnumerator();

Expand Down Expand Up @@ -73,6 +75,11 @@ public static void Main(string[] args)
enumerator.MoveNext();
serverInterface = (string)enumerator.Current;
}
else if (arg == "--encoding")
{
enumerator.MoveNext();
encoding = Encoding.GetEncoding((string)enumerator.Current);
}
else
{
otherArgs.Add((string)enumerator.Current);
Expand Down Expand Up @@ -100,6 +107,11 @@ public static void Main(string[] args)

if (transportType == TransportType.Stdio)
{
if (encoding != null)
{
Console.InputEncoding = encoding;
Console.OutputEncoding = encoding;
}
builder.UseServer(new StdioServer(Console.In, writer));
}
else
Expand Down

0 comments on commit f4d1dbf

Please sign in to comment.