UTF-8 with BOM

This commit is contained in:
nilaoda 2022-09-18 18:09:34 +08:00
parent a0f3709559
commit 71e60af5f3
2 changed files with 8 additions and 8 deletions

View File

@ -370,7 +370,7 @@ namespace N_m3u8DL_RE.DownloadManager
subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat);
output = Path.ChangeExtension(output, ".srt"); 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() FileDic[keys.First()] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,
@ -405,7 +405,7 @@ namespace N_m3u8DL_RE.DownloadManager
subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat);
output = Path.ChangeExtension(output, ".srt"); output = Path.ChangeExtension(output, ".srt");
} }
await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8);
FileDic[firstKey] = new DownloadResult() FileDic[firstKey] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,
@ -438,7 +438,7 @@ namespace N_m3u8DL_RE.DownloadManager
subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat);
output = Path.ChangeExtension(output, ".srt"); output = Path.ChangeExtension(output, ".srt");
} }
await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8);
FileDic[firstKey] = new DownloadResult() FileDic[firstKey] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,
@ -475,7 +475,7 @@ namespace N_m3u8DL_RE.DownloadManager
subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat); subContentFixed = OtherUtil.WebVtt2Other(finalVtt, DownloaderConfig.MyOptions.SubtitleFormat);
output = Path.ChangeExtension(output, ".srt"); output = Path.ChangeExtension(output, ".srt");
} }
await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8);
FileDic[firstKey] = new DownloadResult() FileDic[firstKey] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,

View File

@ -313,7 +313,7 @@ namespace N_m3u8DL_RE.DownloadManager
FileDic.Clear(); FileDic.Clear();
var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(files.Last()) + ".vtt"); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(files.Last()) + ".vtt");
var subContentFixed = finalVtt.ToString(); var subContentFixed = finalVtt.ToString();
await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8);
FileDic[keys.First()] = new DownloadResult() FileDic[keys.First()] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,
@ -339,7 +339,7 @@ namespace N_m3u8DL_RE.DownloadManager
FileDic.Clear(); FileDic.Clear();
var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt"); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt");
var subContentFixed = finalVtt.ToString(); var subContentFixed = finalVtt.ToString();
await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8);
FileDic[firstKey] = new DownloadResult() FileDic[firstKey] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,
@ -361,7 +361,7 @@ namespace N_m3u8DL_RE.DownloadManager
FileDic.Clear(); FileDic.Clear();
var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt"); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt");
var subContentFixed = finalVtt.ToString(); var subContentFixed = finalVtt.ToString();
await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8);
FileDic[firstKey] = new DownloadResult() FileDic[firstKey] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,
@ -387,7 +387,7 @@ namespace N_m3u8DL_RE.DownloadManager
FileDic.Clear(); FileDic.Clear();
var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt"); var path = Path.Combine(tmpDir, Path.GetFileNameWithoutExtension(mp4s.Last()) + ".vtt");
var subContentFixed = finalVtt.ToString(); var subContentFixed = finalVtt.ToString();
await File.WriteAllTextAsync(path, subContentFixed, new UTF8Encoding(false)); await File.WriteAllTextAsync(path, subContentFixed, Encoding.UTF8);
FileDic[firstKey] = new DownloadResult() FileDic[firstKey] = new DownloadResult()
{ {
ActualContentLength = subContentFixed.Length, ActualContentLength = subContentFixed.Length,