Fix crash in TTML IMSC 1.1 - thx Louie :)

This commit is contained in:
Nikolaj Olsson 2024-07-17 17:32:34 +02:00
parent ac846d0835
commit 40a39e83ac

View File

@ -117,8 +117,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
xmlTitle = "Untitled";
}
xmlStructure = xmlStructure.Replace("[title]", HtmlUtil.EncodeNamed(xmlTitle));
var titleNode = xml.CreateElement("ttm", "title", TimedText10.TtmlMetadataNamespace);
titleNode.InnerText = xmlTitle;
xmlStructure = xmlStructure.Replace("[title]", titleNode.InnerXml);
var language = LanguageAutoDetect.AutoDetectGoogleLanguage(subtitle);
xmlStructure = xmlStructure.Replace("lang=\"en\"", $"lang=\"{language}\"");