Skip to content

Commit

Permalink
DAR: Set Encoding to UTF-8 (#1411)
Browse files Browse the repository at this point in the history
DAR failed to set the encoding to UTF-8, leading to corrupt messages if we tried to marshal non-ascii strings.
  • Loading branch information
gregg-miskelly authored Jul 25, 2023
1 parent 202416e commit 3986396
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/DebugAdapterRunner/DebugAdapterRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public class DebugAdapterRunner

private IDictionary<string, CallbackRequestHandler> _callbackHandlers = new Dictionary<string, CallbackRequestHandler>();

private static readonly Encoding s_utf8NoBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);

// Current list of responses received from the debug adapter
public List<string> Responses { get; private set; }

Expand Down Expand Up @@ -155,7 +157,9 @@ private void StartDebugAdapter(
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardError = true;
startInfo.StandardOutputEncoding = s_utf8NoBOM;
startInfo.StandardInputEncoding = s_utf8NoBOM;

if (redirectVSAssert)
{
Expand Down

0 comments on commit 3986396

Please sign in to comment.