diff --git a/src/libse/SubtitleFormats/TimedText10.cs b/src/libse/SubtitleFormats/TimedText10.cs
index 9f71fd677..3154c70c2 100644
--- a/src/libse/SubtitleFormats/TimedText10.cs
+++ b/src/libse/SubtitleFormats/TimedText10.cs
@@ -528,8 +528,21 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
try
{
text = string.Join("
", text.SplitToLines());
- XmlDocument paragraphContent = new XmlDocument();
- paragraphContent.LoadXml($"{text.Replace("&", "&")}");
+ var paragraphContent = new XmlDocument();
+
+ try
+ {
+ paragraphContent.LoadXml($"{text.Replace("&", "&")}");
+ }
+ catch
+ {
+ var guid = Guid.NewGuid().ToString();
+ var tempText = text.Replace("&", guid);
+ tempText = tempText.Replace("&", "&");
+ tempText = tempText.Replace(guid, "&");
+ paragraphContent.LoadXml($"{tempText}");
+ }
+
ConvertParagraphNodeToTtmlNode(paragraphContent.DocumentElement, xml, paragraph);
}
catch // Wrong markup, clear it