Skip to content

Commit

Permalink
Enforce AppendAllLinesAsync encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
TiraelSedai committed Jun 23, 2024
1 parent d60a60b commit 41c0ade
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ClubDoorman/SpamHamClassifier.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics;
using System.Globalization;
using System.Text;
using CsvHelper;
using Microsoft.ML;
using Microsoft.ML.Data;
Expand Down Expand Up @@ -78,7 +79,8 @@ private async Task AddSpamHam(string message, bool spam)
message = message.Replace("\"", "\"\"");
message = $"\"{message}\", {spam}";
using var token = await SemaphoreHelper.AwaitAsync(_datasetLock);
await File.AppendAllLinesAsync(SpamHamDataset, [message]);
var utf8WithoutBom = new UTF8Encoding(false);
await File.AppendAllLinesAsync(SpamHamDataset, [message], utf8WithoutBom);
_needsRetraining = true;
}

Expand Down

0 comments on commit 41c0ade

Please sign in to comment.