mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Merge pull request #226 from ash-hat/remove-utf8-bom
Remove BOM from UTF-8 File Encodings
This commit is contained in:
4 files changed
+8
-3
No files matched your search
@@ -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)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BepInEx
|
||||
}
|
||||
|
||||
var originalOutStream = OpenFileStream(stdout);
|
||||
StandardOut = new StreamWriter(originalOutStream, new UTF8Encoding(false))
|
||||
StandardOut = new StreamWriter(originalOutStream, Utility.UTF8NoBom)
|
||||
{
|
||||
AutoFlush = true
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user