Skip to content

Commit c723d18

Browse files
author
Christian Melendez
committed
Added the UTF8 encoder without the BOM character
1 parent 70b46fa commit c723d18

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Serilog.Sinks.File/Sinks/File/FileSink.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using System.IO;
16+
using System.IO;
1717
using System.Text;
1818
using Serilog.Core;
1919
using Serilog.Debugging;
@@ -56,7 +56,7 @@ public FileSink(string path, ITextFormatter textFormatter, long? fileSizeLimitBy
5656
TryCreateDirectory(path);
5757

5858
var file = System.IO.File.Open(path, FileMode.Append, FileAccess.Write, FileShare.Read);
59-
var outputWriter = new StreamWriter(file, encoding ?? new UTF8Encoding(false));
59+
var outputWriter = new StreamWriter(file, encoding ?? new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
6060
if (fileSizeLimitBytes != null)
6161
{
6262
var initialBytes = file.Length;

src/Serilog.Sinks.File/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"dependencies": {
2222
"System.IO": "4.1.0",
2323
"System.IO.FileSystem": "4.0.1",
24-
"System.IO.FileSystem.Primitives": "4.0.1"
24+
"System.IO.FileSystem.Primitives": "4.0.1",
25+
"System.Text.Encoding.Extensions": "4.0.11"
2526
}
2627
}
2728
}

0 commit comments

Comments
 (0)