Skip to content

Commit e135114

Browse files
author
xiangb-a
committed
We should determine if it is a console program, and only set the encoding format for the console program if it is a console program
1 parent a95d986 commit e135114

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ModelContextProtocol.Core/Client/StdioClientTransport.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public async Task<ITransport> ConnectAsync(CancellationToken cancellationToken =
156156
// up the encoding from Console.InputEncoding. As such, when not targeting .NET Core,
157157
// we temporarily change Console.InputEncoding to no-BOM UTF-8 around the Process.Start
158158
// call, to ensure it picks up the correct encoding.
159-
#if !NET
159+
160160
Encoding originalInputEncoding = Console.InputEncoding;
161161
if (HasConsole())
162162
{
@@ -169,7 +169,7 @@ public async Task<ITransport> ConnectAsync(CancellationToken cancellationToken =
169169
Console.InputEncoding = originalInputEncoding;
170170
}
171171
}
172-
#endif
172+
173173
processStarted = process.Start();
174174

175175
if (!processStarted)

0 commit comments

Comments
 (0)