From 0282a1ed09e40464d944977411cf3ae302aa32a4 Mon Sep 17 00:00:00 2001 From: obradovichv <53901450+obradovichv@users.noreply.github.com> Date: Sun, 3 Jan 2021 20:13:21 +0200 Subject: Fix string culture specificity Fix bug in SsaParser.cs primary color {\1c} formatting that would leave behind the {\1c} closing token and instead append token unconditionally to the dialogue text. Add tests. Change AlphanumComparatorTests.cs complementary test data generation from an array shuffle to an array reversal. Although it was previously using a seeded Random, the shuffle itself could result in no rearrangement of elements if the seed or test data changed over time. The reversal guarantees reordering of elements and has the added benefit of simplifying the test code since no special handling is needed for arrays of 2 elements. Change DailyTrigger.cs logging of TriggerDate format to "yyyy-MM-dd HH:mm:ss.fff zzz" for consistency with configured log timestamp format and change DueTime format to culture-invariant "c" format. --- MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.MediaEncoding') diff --git a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs index db6b47583..bc84c5074 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs @@ -325,7 +325,15 @@ namespace MediaBrowser.MediaEncoding.Subtitles text = text.Insert(start, ""); } - text += ""; + int indexOfEndTag = text.IndexOf("{\\1c}", start, StringComparison.Ordinal); + if (indexOfEndTag > 0) + { + text = text.Remove(indexOfEndTag, "{\\1c}".Length).Insert(indexOfEndTag, ""); + } + else + { + text += ""; + } } } } -- cgit v1.2.3