diff options
| author | David <daullmer@gmail.com> | 2020-12-29 00:35:59 +0100 |
|---|---|---|
| committer | David <daullmer@gmail.com> | 2020-12-29 00:35:59 +0100 |
| commit | 3dec1fd6b23fa4f7f9bc3f66edca8ec0f285ae0f (patch) | |
| tree | 3908e243168eff9334be335dddaf440c47bff1c2 /Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs | |
| parent | 8ac1ed16ca6d539cf9061b3c9de139dcf148f401 (diff) | |
Use UTF8 encoding and async correctly
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs')
| -rw-r--r-- | Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index 0bb627192..29440b64a 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -4,6 +4,7 @@ using System; using System.Globalization; using System.IO; using System.Linq; +using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -144,7 +145,7 @@ namespace Emby.Server.Implementations.ScheduledTasks { try { - var jsonString = File.ReadAllText(path); + var jsonString = File.ReadAllText(path, Encoding.UTF8); if (!string.IsNullOrWhiteSpace(jsonString)) { _lastExecutionResult = JsonSerializer.Deserialize<TaskResult>(jsonString, _jsonOptions); @@ -540,7 +541,7 @@ namespace Emby.Server.Implementations.ScheduledTasks TaskTriggerInfo[] list = null; if (File.Exists(path)) { - var jsonString = File.ReadAllText(path); + var jsonString = File.ReadAllText(path, Encoding.UTF8); list = JsonSerializer.Deserialize<TaskTriggerInfo[]>(jsonString, _jsonOptions); } @@ -578,7 +579,7 @@ namespace Emby.Server.Implementations.ScheduledTasks Directory.CreateDirectory(Path.GetDirectoryName(path)); var json = JsonSerializer.Serialize(triggers, _jsonOptions); - File.WriteAllText(path, json); + File.WriteAllText(path, json, Encoding.UTF8); } /// <summary> |
