Remove BOM from log and config files

This commit is contained in:
Ash committed 2021-04-07 17:15:33 -05:00
1 parent 9bed791bd6
commit 9d59aaae79
3 files changed
+7 -2

No files matched your search

+1 -1
View File
@@ -281,7 +281,7 @@ namespace BepInEx.Configuration
var directoryName = Path.GetDirectoryName(ConfigFilePath);
if (directoryName != null) Directory.CreateDirectory(directoryName);
using (var writer = new StreamWriter(ConfigFilePath, false, Encoding.UTF8))
using (var writer = new StreamWriter(ConfigFilePath, false, Utility.UTF8NoBom))
{
if (_ownerMetadata != null)
{
+1 -1
View File
@@ -53,7 +53,7 @@ namespace BepInEx.Logging
localPath = $"LogOutput.{counter++}.log";
}
LogWriter = TextWriter.Synchronized(new StreamWriter(fileStream, Encoding.UTF8));
LogWriter = TextWriter.Synchronized(new StreamWriter(fileStream, Utility.UTF8NoBom));
if (delayedFlushing) FlushTimer = new Timer(o => { LogWriter?.Flush(); }, null, 2000, 2000);
+5
View File
@@ -22,6 +22,11 @@ namespace BepInEx
/// <see cref="System.Reflection.Emit" /> namespace.
/// </summary>
public static bool CLRSupportsDynamicAssemblies => CheckSRE();
/// <summary>
/// An encoding for UTF-8 which does not emit a byte order mark (BOM).
/// </summary>
public static Encoding UTF8NoBom { get; } = new UTF8Encoding(false);
private static bool CheckSRE()
{