From 71e60af5f3c5e2392fdaf3ed6d9a1be666004cc6 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sun, 18 Sep 2022 18:09:34 +0800 Subject: [PATCH] UTF-8 with BOM --- src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs | 8 ++++---- .../DownloadManager/SimpleLiveRecordManager2.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs index e09f479..17db578 100644 --- a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs +++ b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs @@ -370,7 +370,7 @@ namespace N_m3u8DL_RE.DownloadManager subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); output = Path.ChangeExtension(output, ".srt"); } - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[keys.First()] = new DownloadResult() { ActualContentLength = subContentFixed.Length, @@ -405,7 +405,7 @@ namespace N_m3u8DL_RE.DownloadManager subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); output = Path.ChangeExtension(output, ".srt"); } - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[firstKey] = new DownloadResult() { ActualContentLength = subContentFixed.Length, @@ -438,7 +438,7 @@ namespace N_m3u8DL_RE.DownloadManager subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); output = Path.ChangeExtension(output, ".srt"); } - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[firstKey] = new DownloadResult() { ActualContentLength = subContentFixed.Length, @@ -475,7 +475,7 @@ namespace N_m3u8DL_RE.DownloadManager subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); output = Path.ChangeExtension(output, ".srt"); } - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[firstKey] = new DownloadResult() { ActualContentLength = subContentFixed.Length, diff --git a/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs b/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs index ee4ba38..26a44d7 100644 --- a/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs +++ b/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs @@ -313,7 +313,7 @@ namespace N_m3u8DL_RE.DownloadManager FileDic.Clear(); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(files.Last()) + ".vtt"); var subContentFixed = finalVtt.ToString(); - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[keys.First()] = new DownloadResult() { ActualContentLength = subContentFixed.Length, @@ -339,7 +339,7 @@ namespace N_m3u8DL_RE.DownloadManager FileDic.Clear(); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt"); var subContentFixed = finalVtt.ToString(); - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[firstKey] = new DownloadResult() { ActualContentLength = subContentFixed.Length, @@ -361,7 +361,7 @@ namespace N_m3u8DL_RE.DownloadManager FileDic.Clear(); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt"); var subContentFixed = finalVtt.ToString(); - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[firstKey] = new DownloadResult() { ActualContentLength = subContentFixed.Length, @@ -387,7 +387,7 @@ namespace N_m3u8DL_RE.DownloadManager FileDic.Clear(); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt"); var subContentFixed = finalVtt.ToString(); - await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); + await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8); FileDic[firstKey] = new DownloadResult() { ActualContentLength = subContentFixed.Length,