Respect encoding of TextWriter provided to AnsiConsole.Create(...)

This commit is contained in:
Alexey Golub 2021-03-25 22:19:49 +02:00 committed by GitHub
parent 8830779875
commit 2ba6da3514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,8 +28,8 @@ namespace Spectre.Console
// Detect if the terminal support ANSI or not
var (supportsAnsi, legacyConsole) = DetectAnsi(settings, buffer);
// Use the provided encoding or fall back to UTF-8
var encoding = buffer.IsStandardOut() || buffer.IsStandardError() ? System.Console.OutputEncoding : Encoding.UTF8;
// Use console encoding or fall back to provided encoding
var encoding = buffer.IsStandardOut() || buffer.IsStandardError() ? System.Console.OutputEncoding : buffer.Encoding;
// Get the color system
var colorSystem = settings.ColorSystem == ColorSystemSupport.Detect