From 3986396d9c31c6ac729c6b52fa79f34d7a253e95 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Tue, 25 Jul 2023 10:33:41 -0700 Subject: [PATCH] DAR: Set Encoding to UTF-8 (#1411) DAR failed to set the encoding to UTF-8, leading to corrupt messages if we tried to marshal non-ascii strings. --- test/DebugAdapterRunner/DebugAdapterRunner.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/DebugAdapterRunner/DebugAdapterRunner.cs b/test/DebugAdapterRunner/DebugAdapterRunner.cs index 1e8921452..2d7315f6e 100644 --- a/test/DebugAdapterRunner/DebugAdapterRunner.cs +++ b/test/DebugAdapterRunner/DebugAdapterRunner.cs @@ -56,6 +56,8 @@ public class DebugAdapterRunner private IDictionary _callbackHandlers = new Dictionary(); + private static readonly Encoding s_utf8NoBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); + // Current list of responses received from the debug adapter public List Responses { get; private set; } @@ -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) {