diff --git a/src/Docfx.Build/PostProcessors/HtmlPostProcessor.cs b/src/Docfx.Build/PostProcessors/HtmlPostProcessor.cs index 0532739afde..7aeadfdcc62 100644 --- a/src/Docfx.Build/PostProcessors/HtmlPostProcessor.cs +++ b/src/Docfx.Build/PostProcessors/HtmlPostProcessor.cs @@ -13,6 +13,8 @@ namespace Docfx.Build.Engine; sealed class HtmlPostProcessor : IPostProcessor { + private static readonly UTF8Encoding Utf8EncodingWithoutBom = new(false); + public List Handlers { get; } = new List(); private bool _handlerInitialized; @@ -79,7 +81,7 @@ where output.Key.Equals(".html", StringComparison.OrdinalIgnoreCase) } using (var stream = EnvironmentContext.FileAbstractLayer.Create(tuple.OutputFile)) { - document.Save(stream, Encoding.UTF8); + document.Save(stream, Utf8EncodingWithoutBom); } } foreach (var handler in Handlers)