From 1aef2a75045eda29fb3e12de7ee2bd018609e2fa Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sat, 2 Jul 2022 01:09:10 +0800 Subject: [PATCH] Remove Zero Width Space --- src/N_m3u8DL-RE.Common/Entity/WebSub.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/N_m3u8DL-RE.Common/Entity/WebSub.cs b/src/N_m3u8DL-RE.Common/Entity/WebSub.cs index 01f3994..584b1cc 100644 --- a/src/N_m3u8DL-RE.Common/Entity/WebSub.cs +++ b/src/N_m3u8DL-RE.Common/Entity/WebSub.cs @@ -22,6 +22,17 @@ namespace N_m3u8DL_RE.Common.Entity return Parse(Encoding.UTF8.GetString(textBytes)); } + /// + /// 从字节数组解析WEBVTT + /// + /// + /// + /// + public static WebSub Parse(byte[] textBytes, Encoding encoding) + { + return Parse(encoding.GetString(textBytes)); + } + /// /// 从字符串解析WEBVTT /// @@ -66,9 +77,9 @@ namespace N_m3u8DL_RE.Common.Entity { StartTime = startTime, EndTime = endTime, - Payload = payload, + Payload = string.Join("", payload.Where(c => c != 8203)), //Remove Zero Width Space! Settings = style - }); + }) ; needPayload = false; } }