From 6b52636ec4535da19402d45c58edc1971e711b8d Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Sat, 19 Oct 2024 12:21:34 +0900 Subject: [PATCH] BREAKING CHANGE: Change generated HTML encoding to UTF-8N (without BOM) (#10069) chore: change generated HTML encoding to UTF-8 without BOM --- src/Docfx.Build/PostProcessors/HtmlPostProcessor.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Docfx.Build/PostProcessors/HtmlPostProcessor.cs b/src/Docfx.Build/PostProcessors/HtmlPostProcessor.cs index 2afb2514162..a052eaed954 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(); private bool _handlerInitialized; @@ -81,7 +83,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)