Skip to content

Commit 8f03f6d

Browse files
committed
配置强行编码输出
1 parent ab5544d commit 8f03f6d

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

DebUOS/Packaging.DebUOS.Tool/Options.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@ public class Options
2222

2323
[Option('o', "Output", Description = "Output path", LocalizableDescription = "输出的 deb 文件路径")]
2424
public string? OutputPath { set; get; }
25+
26+
/// <summary>
27+
/// 是否强行使用 UTF-8 编码作为控制台输出
28+
/// </summary>
29+
[Option()]
30+
public bool? ForceUtf8ConsoleOutput { get; init; }
2531
}

DebUOS/Packaging.DebUOS.Tool/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
var options = CommandLine.Parse(args).As<Options>();
1616

17+
if (options.ForceUtf8ConsoleOutput is true)
18+
{
19+
Console.OutputEncoding = Encoding.UTF8;
20+
}
21+
1722
var loggerFactory = LoggerFactory.Create(builder =>
1823
{
1924
builder.AddConsole(loggerOptions => loggerOptions.FormatterName = MSBuildFormatter.FormatterName);

0 commit comments

Comments
 (0)