diff --git a/libse/HtmlUtil.cs b/libse/HtmlUtil.cs
index efc1326f2..43af931b7 100644
--- a/libse/HtmlUtil.cs
+++ b/libse/HtmlUtil.cs
@@ -563,6 +563,8 @@ namespace Nikse.SubtitleEdit.Core
text = text.Replace("< I >", beginTag);
text = text.Replace("< I>", beginTag);
text = text.Replace("", beginTag);
+ text = text.Replace("", endTag);
text = text.Replace("< /i>", endTag);
@@ -579,6 +581,8 @@ namespace Nikse.SubtitleEdit.Core
text = text.Replace("", endTag);
text = text.Replace(" I >", endTag);
text = text.Replace("< / I>", endTag);
+ text = text.Replace("", beginTag);
text = text.Replace("", endTag);
diff --git a/src/Test/Logic/UtilitiesTest.cs b/src/Test/Logic/UtilitiesTest.cs
index e611ef669..9f02ac148 100644
--- a/src/Test/Logic/UtilitiesTest.cs
+++ b/src/Test/Logic/UtilitiesTest.cs
@@ -437,6 +437,14 @@ namespace Test.Logic
Assert.AreEqual(s2, "{\\an8}Hallo!" + Environment.NewLine + "Hallo!");
}
+ [TestMethod]
+ public void FixInvalidItalicTagsBadStartTag()
+ {
+ var s1 = "";
+ string s2 = HtmlUtil.FixInvalidItalicTags(s1);
+ Assert.AreEqual( "Hallo!", s2);
+ }
+
[TestMethod]
public void FixUnneededSpacesDoubleSpace1()
{